$_ = "1/ 2/ 3/"; m{/}g; # will set pos to 2, the offset of the first '/' s{\G(.*?)/}{$1}g; # \G is like ^, but instead of matching # a line begining it matches the place # where the last /g modified regexp left # off. print;