On 2011-05-15 18:28, Mike McClain wrote:
In reading in a file of space separated columns of numbers
and stuffing them into an array, I used:
while( my $line =<$FH> )
{ my @arr = split /\s+/, $line;
push @primes_array, @arr;
}
but kept getting empty array entries until I switched to:
while(<$FH> )
{ my @arr = split;
push @primes_array, @arr;
}
perldoc -f split says:
If EXPR is omitted, splits the $_ string.
If PATTERN is also omitted, splits on whitespace
(after skipping any leading whitespace).
My question is what RE do I need to pass to split to get
the same return from split /$RE/, $line;
as I get from the split against $_.
That can be your question, but have you also compared the lines with the
differences? They probably start with whitespace.
--
Ruud
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/