in reply to Re: unable to post to forum
in thread unable to post to forum

The embedded my? Yes it's perfectly valid, although I quite agree that it looks odd, but the simple fact of the matter is that lexicals can be created pretty much anywhere in a statement.

It's (I think) what lets you do:

if( my $foo = bar(@quux) ) { $foo exists here } # no foo here

I'm certain it's what lets you say:

(my $copy = $original) =~ s/foo/bar/;

That is, the variable $copy doesn't fall out of scope outside the parentheses. Sometimes it makes for nicer code, sometimes bizarre. Be wary of trying this new toy out everywhere :)

• another intruder with the mooring in the heart of the Perl