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?

Replies are listed 'Best First'.
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.