in reply to Splits and pipes
The first argument to split is (usually, and definitely in this case) a regular expression. The pipe symbol | is a metacharacter in regexes meaning 'or' - so you've told split to split off whenever it matches a null character or a null cahracter. This happens between every character.
I think what you wanted was: ($acc_num, $ofname,$junk,$olname,$junk2) = split /\|/, $line, 5; where the backslash makes the pipe character match literally.
--Bob Niederman, http://bob-n.comAll code given here is UNTESTED unless otherwise stated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Splits and pipes
by cens (Novice) on Sep 06, 2003 at 21:26 UTC | |
by bobn (Chaplain) on Sep 06, 2003 at 21:30 UTC |