Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: Do not understand code

by Eily (Monsignor)
on Oct 02, 2017 at 16:09 UTC ( [id://1200534]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Do not understand code
in thread Do not understand code

Actually I would expect $ARGV for $_ to mostly be a side effect of @ARGV for @_. This also works for other punctuation variables and their english versions

perl -MEnglish -E "@; = q<Hi>; say @SUBSEP" Hi
It's not a name that perl parses, but I'd expect pretty much everyone here to understand what "the default variable" refers too.

Replies are listed 'Best First'.
Re^4: Do not understand code
by LanX (Saint) on Oct 02, 2017 at 16:25 UTC
    > to understand what "the default variable" refers too.

    We could consider adding $DEF or $DEFAULT for $_ to Perl.

    > @; = q<Hi>; say @SUBSEP

    I suppose these are just glob aliases, that's why they work for all types associated to a symbol.

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!

      I suppose these are just glob aliases, that's why they work for all types associated to a symbol.
      Yup, as confirmed by reading the code for English. @- and $- have different names though, so only the ARRAY and SCALAR portion of the glob are used in those cases.

      I was about to say that if you want to have a longer name instead of $_ you can just use a lexical instead (I was thinking of for loops), but I forgot about grep and map where you have to use $_. $CURRENT would work in those cases.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1200534]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-24 05:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found