- or download this
/\A\s*(.*?)\s*\z/
- or download this
say for map { (/\A\s*(.*?)\s*\z/) } split /\|/, $str;
- or download this
say for map { clean($_) } split /\|/, $str;
sub clean { ($_[0] =~ /\A\s*(.*?)\s*\z/)[0] }
- or download this
$ perl -Mstrict -Mwarnings -E '
my $str = " \t item0 with leading whitespace |item1 | item2| item3
...
<item4>
<>
<itemN with trailing whitespace>