The split function can get rid of the white space also.
#!/usr/bin/perl use strict; use warnings; my $str = "item1 | item2| item3 |item4| "; print ">$_<\n" foreach split /\s*\|\s*/, $str;
In reply to Re: How to call a function on each item after a split?
by Lotus1
in thread How to call a function on each item after a split?
by MrSnrub
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |