husker has asked for the wisdom of the Perl Monks concerning the following question:
However, I have discovered that some lines may start with whitespace, meaning sometimes I get 4 elements in @flds, and sometimes 5, in which case the first element of @flds is empty. This screws up the code I have later that depends on certain values being in certain places in @flds. Is there a pattern I can use that would discard this first empty field? Or must I, for instance, test for this emptiness and shift it away?@flds = split(/\s+/);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A regexp/split question
by swiftone (Curate) on Jun 08, 2000 at 00:39 UTC | |
|
Re: A regexp/split question
by takshaka (Friar) on Jun 08, 2000 at 00:41 UTC | |
|
Re: A regexp/split question
by ivey (Beadle) on Jun 08, 2000 at 00:39 UTC | |
|
Re: A regexp/split question
by mdillon (Priest) on Jun 08, 2000 at 00:37 UTC | |
|
A regexp/split question
by young_yang (Acolyte) on Jun 08, 2000 at 06:20 UTC | |
by takshaka (Friar) on Jun 08, 2000 at 11:05 UTC | |
|
RE: A regexp/split question
by Corion (Patriarch) on Jun 08, 2000 at 11:42 UTC |