in reply to Re^4: A curious case of of my() (What is GLOBAL?)
in thread A curious case of of my()

... special vars like $_ which always belong to main:: without full qualification

...unless $_ is lexicalized in the current scope :)

$_=666; { my $_=777; print $_; # -> 777 print $main::_; # -> 666 }

(just meaning to say that $_ isn't the best example — otherwise I agree of course)

Replies are listed 'Best First'.
Re^6: A curious case of of my() (What is GLOBAL?)
by LanX (Saint) on Apr 05, 2011 at 12:52 UTC
    I'm not sure but IIRC lexical $_ is a rather new feature...

    But thanks!

    Cheers Rolf

      It depends what you call "rather new". It was introduced in December 2007, when 5.10 hit the street. It's now April 2011, with 5.14-RC0 looming around the corner.

      More than 3 years, and the almost the life-span of 2 major releases - not something I would call "rather new".

        > It depends what you call "rather new". It was introduced in December 2007, when 5.10 hit the street.

        Hmm, for me: "System Perl available on a majority of running systems for more than 1 or 2 years".¹

        So you have to add the average time span between system installations and lag of update into distributions for an approximation.

        > More than 3 years, and the almost the life-span of 2 major releases - not something I would call "rather new".

        I still do! Only a minority of users update their Perl to the newest release ASAP.

        But I agree that it's only a weak "rather".

        Cheers Rolf

        1) or in other words: If it doesn't work, you can blame the system admin!

      It's present in every Perl version that wasn't officially EOLed. Even 5.10 will be EOLed in a month, if I understand correctly.