my $self = shift;
my($op, $cx, $text) = @_;
if ($op->private & OPpLVAL_INTRO and not $self->{'avoid_local'}{$$op}) {
- return $self->maybe_parens_func("local", $text, $cx, 16);
+ if (want_scalar($op)) {
+ return "local $text";
+ } else {
+ return $self->maybe_parens_func("local", $text, $cx, 16);
+ }
} else {
return $text;
}
my $self = shift;
my($op, $cx, $text) = @_;
if ($op->private & OPpLVAL_INTRO and not $self->{'avoid_local'}{$$op}) {
- return $self->maybe_parens_func("my", $text, $cx, 16);
+ if (want_scalar($op)) {
+ return "my $text";
+ } else {
+ return $self->maybe_parens_func("my", $text, $cx, 16);
+ }
} else {
return $text;
}