Hena has asked for the wisdom of the Perl Monks concerning the following question:
Name number number number Name number number number ...Now the number fields can be empty so basicly i have some rows which have only name and tabs. I've noticed that split does not return empty cells properly. There is a bit about using pattern " ", it will skip leading whitespace. but that should not apply here. I've added a simple script which shows the problem.
#!/usr/bin/perl # # testing split # use warnings; use strict; my $a="val "; print "'$a'\n"; my @a=split (/\t/,$a); my $val=scalar (@a); print "$val '@a'\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Preserving empty fields in split
by pjf (Curate) on Feb 05, 2004 at 12:11 UTC | |
|
Re: Working of split
by Abigail-II (Bishop) on Feb 05, 2004 at 12:04 UTC | |
by Hena (Friar) on Feb 05, 2004 at 12:07 UTC | |
by Abigail-II (Bishop) on Feb 05, 2004 at 12:09 UTC | |
by Hena (Friar) on Feb 05, 2004 at 12:16 UTC | |
by podian (Scribe) on Feb 05, 2004 at 20:47 UTC | |
|
Re: Working of split
by Zaxo (Archbishop) on Feb 05, 2004 at 12:12 UTC |