in reply to Finding the length of an aray in a hash
Just use a proper data structure and you don't have to worry about splitting or temporary arrays.
my %cmd = ( Mon => [ qw( Jim ) ], Tue => [ qw( Jim Paul ) ], Wed => [ qw( Jim Paul Annie ) ], ); print scalar @{ $cmd{ $_ } }, " can't make it on $_\n" foreach keys %cmd;
perldoc perldsc, perldoc perllol, perldoc perlreftut
But to answer the original question, no it's not necessary. split in scalar context does the right thing.
|
|---|