in reply to Uninitialised value in list assignment
To avoid it, you can explicitly get and check the split() results:($x, $ENV{Z1Z1}) = ( '3', '2,1' ); # first time ($x, $ENV{Z1Z1}) = ( '2', '1' ); # second time ($x, $ENV{Z1Z1}) = ( '1', undef ); # third time
my @arr = split /,/, $ENV{'Z' . uc $foo}, 2; $x = shift @arr; $ENV{'Z' . uc $foo} = scalar @arr ? $arr[0] : ''; # set to empty s +tring if nothing available
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Uninitialised value in list assignment
by Tanktalus (Canon) on Jun 26, 2005 at 22:28 UTC | |
by ysth (Canon) on Jun 26, 2005 at 23:23 UTC |