in reply to Re: Re: Re: split/map weirdness: empty strings vs undef
in thread split/map weirdness: empty strings vs undef
Uhm... split(/\|/, "2|3||||"); is different from split('|', "2|3||||"); only because that pipe isn't escaped in the second one. Perl will split on that as if it were a pattern. In other words, that's broken in the same way as your original one. Note that splitting on a literal space is a special case. This isn't.
$ perl -le '$_="2|3|||||"; @a = split q(|); print "($_)" for @a' (2) (|) (3) (|) (|) (|) (|) (|) $ perl -le '$_="2|3|||||"; @a = split /|/; print "($_)" for @a' (2) (|) (3) (|) (|) (|) (|) (|)
-sauoq "My two cents aren't worth a dime.";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: split/map weirdness: empty strings vs undef
by dws (Chancellor) on Oct 04, 2002 at 21:39 UTC | |
by sauoq (Abbot) on Oct 04, 2002 at 21:56 UTC |