in reply to split and uninitialized variables
I prefer to store the list returned by split in an array or hash slice:
use strict; use warnings; use Data::Dumper; my @key = qw(x y z); my %hash; while (<DATA>) { chomp; @hash{@key} = split ','; print Dumper \%hash; } __DATA__ a,b,c a,b a,b,c,d a,,,
[UPDATE] No. Scalars are not the better choice simply because you know what the data that you are working on looks like. If you deal with multiple things, why not put them in a container so you only have to move one thing around? :)
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: split and uninitialized variables
by podian (Scribe) on Sep 03, 2004 at 16:28 UTC | |
by Aristotle (Chancellor) on Sep 03, 2004 at 17:36 UTC |
In Section
Seekers of Perl Wisdom