On Aug 17, marcos rebelo said:
my @col = grep(!/\t/, split(/(\t)/, $line));
push(@col, "") if $line =~ /\t$/;
Wow. That could have just been
my @col = split /\t/, $line;
push @col, "" if $line =~ /\t$/;
which should REALLY have been written as
my @col = split /\t/, $line, -1;
The third argument of -1 means "include all empty trailing fields", so
that if your data is "abc\tdef\tghi\t\t\t", you'll get ("abc", "def",
"ghi", "", "", "") back.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>