Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

What does this mean?

by Anonymous Monk
on Jul 12, 2007 at 06:33 UTC ( [id://626145]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
when i am looking into some perl code i noticed the following lines of code.
local($prompt, @cmp_list, $return, @match, $l, $test, $cmp, $r); if ($_[1] =~ /^StB\0/) { ($prompt, *_) = @_; } ...
i don't understand the 3rd line  ($prompt, *_) = @_;
what is *_?. I searched perldoc for special variables but in vein. Can anyone explain me that? Thanks.

Replies are listed 'Best First'.
Re: What does this mean?
by sgt (Deacon) on Jul 12, 2007 at 07:30 UTC

    You have a list assignment in which the second slot, a typeglob, will be assigned the se second member of @_. *_ is the typeglob associated with the default variable "$_". In some cases where there are special properties (magic) bound to the underlying object (as in a tie for example) *_ is the thing to use to properly localize "$_".

    It could also be that the author wanted to do a selective typeglob assignment; tough to say with so little code and of doubtful use for the variable _ (er.."$_").

    cheers --stephan
Re: What does this mean?
by swampyankee (Parson) on Jul 12, 2007 at 11:55 UTC

    It means you should study more.

    Backstory

    I couldn't resist the temptation! One of the professors where I went to college would regularly turn to the class and ask "What does this mean?" One day some students put a sign up in the room asking "What does this mean?" The professor's answer? "It means you should study more."

    emc

    Any New York City or Connecticut area jobs? I'm currently unemployed.

    There are some enterprises in which a careful disorderliness is the true method.

    —Herman Melville
Re: What does this mean?
by jesuashok (Curate) on Jul 12, 2007 at 07:13 UTC

    That is called typegolb. This used to create symbol table aliases.

Re: What does this mean?
by Anonymous Monk on Jul 12, 2007 at 06:45 UTC
    $_ %_ @_ *_ $a %a @a *a $foo %foo @foo *foo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-29 06:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found