Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

A2P or not 2P

by bitman (Beadle)
on Mar 28, 2002 at 10:53 UTC ( #154921=perlquestion: print w/ replies, xml ) Need Help??
bitman has asked for the wisdom of the Perl Monks concerning the following question:

I converted an Awk to Perl and this line : inok = getline was converted to : $inok = ($_ = &Getline0(),$getline_ok); This appears to be the same as $_ = &Getline0; $inok = $getline_ok; or am I missing some hidden meaning?

Comment on A2P or not 2P
Re: A2P or not 2P
by Juerd (Abbot) on Mar 28, 2002 at 10:57 UTC

    $inok = ($_ = &Getline0(),$getline_ok); This appears to be the same as $_ = &Getline0; $inok = $getline_ok; or am I missing some hidden meaning?

    Your assumption is correct.

    In scalar context, a list with parens evaluates to the last element.

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

Re: A2P or not 2P
by jmcnamara (Monsignor) on Mar 28, 2002 at 13:26 UTC

    You are right the two statements are equivalent.

    It may seem a little obfuscated but I guess the intention was to replace awk's "var = getline" with a single statement.

    --
    John.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2014-08-23 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (178 votes), past polls