Almost. As blakem said, you have to escape the pipe. Maybe more importantly though, the trailing empty fields will disappear in a puff of smoke.
perl -le 'map { print defined($_) ? "def" : "undef" } split(/\|/, "2|3 +|||||"); def def
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: split/map weirdness: empty strings vs undef
by sauoq
in thread split/map weirdness: empty strings vs undef
by hossman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |