roho has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $txt = 'a,b,c,d,,,,,,'; my @fld = split(/,/,$txt); print "\$txt = |$txt|\n"; print "\@fld = |@fld|\n"; for (0 .. $#fld) {print "\$fld\[", $_, "\] = |$fld[$_]|\n"}; __END__ Results: -------- $txt = |a,b,c,d,,,,,,| @fld = |a b c d| $fld[0] = |a| $fld[1] = |b| $fld[2] = |c| $fld[3] = |d|
"Its not how hard you work, its how much you get done."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fooled By Split
by Anonymous Monk on Nov 24, 2003 at 12:07 UTC | |
|
Re: Fooled By Split
by broquaint (Abbot) on Nov 24, 2003 at 12:11 UTC | |
|
Re: Fooled By Split
by roho (Bishop) on Nov 24, 2003 at 12:11 UTC |