in reply to Reading files in scalar context with <> operator
my @array = qw (hi there); my $len = @array; my ($fstel) = @array; # Note the paren () around $fstel print ("Len = $len First element = $fstel\n"); __END__ Len = 2 First element = hi
update: If you have a list, it is not possible for you to get the length of it without putting it into an arrary
For explanation on reading files onto a scalar/list please see holli's post below.
I think you will find this link useful to understand more about lists and arrays
What is the difference between a list and an array?
|
|---|