split takes a regular expression as first argument, not a fixed string (there are exeptions). You need -1 as last argument to get trailing empty fields too.
@fields = split /\|/, $_, -1FWIW, You could also use Text::CSV_XS with sep_char => "|".
In reply to Re: foreach skipping elements
by Tux
in thread foreach skipping elements
by tiggyboo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |