pos
Gets or sets the position of the last m//g match on a string.
As an rvalue, returns the character offset where the most recent
global (/g) match left off, or undef if no match has been
performed on that string. As an lvalue, sets the starting position
for the next m//g match.
Without an argument, operates on $_. Positions are stored in a
side table (pos_table) keyed by string content.
Synopsis
$str =~ /pattern/g;
my $p = pos($str); # position after last /g match
pos($str) = 0; # reset match position
my $p = pos; # defaults to $_