Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

RE: Favorite Symbol Variable

by PipTigger (Friar)
on May 16, 2000 at 05:43 UTC ( #11806=note: print w/ replies, xml ) Need Help??


in reply to Favorite Symbol Variable

The first choice ($_) is the only one I've ever used before (well that's not including "other" which I've certainly used before =) ). Would anyone care to give a terse summary of the usefulness and appropriate contexts for each of the others? For MonksInTraining, it would be nicely instructional. Thanks muchly in advance. TTFN & Shalom.

-PipTigger
p.s. Come to think of it, I like $# better than $_ but it's more like $#xxxx and you don't really get $_xxxx so it probably doesn't belong. =) I'm a dork.
p.p.s. So as not to be a hypocrite, for those who haven't seen $#xxxx before, it is the scalar value associated with the last indexable value in an array (er list... whichever is the politically correct name for it these days). You can quickly modify the size of an array/list by assigning a new value to this scalar (ie. To cut the array junklist in half rounded up do: $#junklist /= 2; ). Keep in mind that this value is always one less than the scalar context of the array name itself (ie. @junklist). This is true even in an empty list when the scalar context for @junklist == 0 && $#junklist == -1. Happy Hacking! =)


Comment on RE: Favorite Symbol Variable
Download Code
RE: RE: Favorite Symbol Variable
by Anonymous Monk on May 17, 2000 at 02:36 UTC
    $@ - how your most recent eval() screwed up. $< - the real uid of your process. $/ - the input line separator; useful for slurping in files. $! - how anything else in your program but eval() most recently screwed up. $* - let Perl assume that strings are single-line for regex matching.
RE: RE: Favorite Symbol Variable
by Anonymous Monk on May 17, 2000 at 03:51 UTC
    $@ - how your most recent eval() screwed up. $< - the real uid of your process. $/ - the input line separator; useful for slurping in files. $! - how anything else in your program but eval() most recently screwed up. $* - let Perl assume that strings are single-line for regex matching.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2014-09-18 06:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (108 votes), past polls