http://www.perlmonks.org?node_id=1045377


in reply to foreach skipping elements

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 /\|/, $_, -1

FWIW, You could also use Text::CSV_XS with sep_char => "|".


Enjoy, Have FUN! H.Merijn