Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Confused by a couple of idioms

by nysus (Vicar)
on Feb 21, 2019 at 23:46 UTC ( #1230342=note: print w/replies, xml ) Need Help??


in reply to Re: Confused by a couple of idioms
in thread Confused by a couple of idioms

Ah, I was reading the precedence like this: ($csv and $xls) = $csv;

I think the lowercase "and" basically makes it act more like this: $csv and ($xls = $csv)

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re^3: Confused by a couple of idioms
by Athanasius (Bishop) on Feb 22, 2019 at 02:40 UTC
    I think the lowercase "and" basically makes it act more like this: $csv and ($xls = $csv)

    Correct. Deparsing makes it even clearer:

    12:28 >perl -MO=Deparse -e "$csv and $xls = $csv;" $xls = $csv if $csv; -e syntax OK 12:29 >

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      Damn, that's crazy. Never knew about that.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

Re^3: Confused by a couple of idioms
by dsheroh (Prior) on Feb 22, 2019 at 08:18 UTC
    I think the lowercase "and" basically makes it act more like this: $csv and ($xls = $csv)
    Yep. That's basically the entire reason that the and and or operators exist. and and or are low-precedence (making them useful for flow control), while && and || are high-precedence (making them useful for boolean logic). This is why, 99% of the time, open ... or die is correct and open ... || die is wrong.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2019-06-18 07:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (81 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!