Consider this code:
#!/usr/local/bin/perl -w
use strict;
my $last = "";
my $first = "";
my $middle = "";
( $last, $first ) = split /,/ , 'thumb,tom' ;
print "last:($last) first($first) middle($middle)\n";
( $first, $middle ) = split / / , $first ;
print "last:($last) first($first) middle($middle)\n";
And what it outputs:
gonzo:/export/home/fredk/: ./bar.pl
last:(thumb) first(tom) middle()
Use of uninitialized value at ./bar.pl line 11.
last:(thumb) first(tom) middle()
Does it make sense that warnings would complain about $middle not being initialized? In my case (the above is simplified) there are some records where there is <NULL> for $middle and others where $middle is defined. So when I print $middle and it is <NULL>, that's WIM (What I Mean).
Suggested work arounds?
-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday