Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Surprise: scalar(($x, $y) = split)

by ambrus (Abbot)
on Oct 28, 2011 at 14:05 UTC ( [id://934407]=note: print w/replies, xml ) Need Help??


in reply to Re: Surprise: scalar(($x, $y) = split)
in thread Surprise: scalar(($x, $y) = split)

It's not the parenthesis that helps there but

Replies are listed 'Best First'.
Re^3: Surprise: scalar(($x, $y) = split)
by roboticus (Chancellor) on Oct 28, 2011 at 14:21 UTC

    ambrus:

    Ha, ha--color me surprised as well!

    Corrected example:

    $ cat foo.pl use strict; use warnings; my $x; my $y; while (<DATA>) { chomp; 2==(($x, $y) = split " ") or print "wrong number of fields\n"; print "<$_>, <$x>, <$y>\n"; } __DATA__ FOO BAR BAZ PLOVE FOO BAR BAZ FOO BAR BAZ $ perl foo.pl wrong number of fields <FOO BAR BAZ PLOVE>, <FOO>, <BAR> wrong number of fields <FOO BAR BAZ>, <FOO>, <BAR> <FOO BAR>, <FOO>, <BAR> wrong number of fields Use of uninitialized value $y in concatenation (.) or string at foo.pl + line 7, <DATA> line 4. <BAZ>, <BAZ>, <>

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://934407]
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: (9)
As of 2024-04-18 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found