Just as you ask, split the line. (assuming the separator is fixed).
You may compare between regex and split solutions, if you like.$ perl -le '$line = shift; @fish = split /\s*fish\s*/, $line; print fo +r @fish' 'One fish two fish red fish blue fish' One two red blue
Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!
In reply to Re: match last element instead of first??
by naikonta
in thread match last element instead of first??
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |