while ( $mystring =~ /(regexp)/g ) { do_something_with($1); }