Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: split and uninitialized variables

by ikegami (Pope)
on Sep 03, 2004 at 15:31 UTC ( #388310=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my ($x, $y, $z) = ('', '', '');
    ($x, $y, $z) = split(',', $_);
    
  2. or download this
    $_ = 'a,b';
    my ($x, $y, $z) = ('', '', '');
    ($x, $y, $z) = split(',', $_);
    print(defined($z)?'defined':'undefined', "\n");
    # prints undefined.
    
  3. or download this
    my ($x, $y, $z) = map { defined($_)?$_:'' } (split(',', $_))[0..2];
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://388310]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2017-09-23 02:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (270 votes). Check out past polls.

    Notices?