|
|
| Pathologically Eclectic Rubbish Lister | |
| PerlMonks |
Re^2: split and uninitialized variablesby ikegami (Patriarch) |
| on Sep 03, 2004 at 11:31 UTC ( [id://388310]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
Your first solution
won't work. Any values assigned in the first line will get overwritten in the second line:
Your second solution my ($x, $y, $z) = map { $_ || '' } split(',', $_); erases any '0'. Try:
Personally, I'd go with the simple my ($x, $y, $z) = (split(',', $_), ('') x 3); solution mentioned elsewhere. Update: Added missing [0..2] as pointed out by Roy Johnson. Thanks.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||