The equivelent to %pos is index which returns the (0 based) index or -1 if the search string isn't found.
Update: Second part.
Perl doesn't provide a built in array lookup returning an index. Perl does however have a lot of ways of manipulating arrays of strings that mean that the lack is not generally a problem. In particular take a look at for, map and grep.
In reply to Re: Returning position?
by GrandFather
in thread Returning position?
by theoya
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |