Given your data set, another option is to use a regex to grab the items you want out of the string. Consider the following:
use strict; use warnings; my $str = "item1 | item2| item3 |item4|"; my @items = $str =~ /\w+/g; print "$_\n" for @items;
Output:
item1 item2 item3 item4
Hope this helps!
In reply to Re: How to call a function on each item after a split?
by Kenosis
in thread How to call a function on each item after a split?
by MrSnrub
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |