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 $_.
Thanks,
Mike
--
Satisfied user of Linux since 1997.
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/