in reply to Re: split and uninitialized variables
in thread split and uninitialized variables

That is what I usually do. But if you know what the data you are working on, then scalars will be better.
One example could be "name, address-line1, address-line2"
and line 2 might be or might not be present.
So to summarise the replies, it would be better to initialize them in the next line.
All the other solutions seem to have some problems!
  • Comment on Re^2: split and uninitialized variables

Replies are listed 'Best First'.
Re^3: split and uninitialized variables
by Aristotle (Chancellor) on Sep 03, 2004 at 17:36 UTC

    The ( '' ) x 3 solution doesn't.

    Another option:

    my ( $foo, $bar, $baz ); $_ .= '' for ( $foo, $bar, $baz ) = split /,/;

    Makeshifts last the longest.