while ( $mystring =~ /(regexp)/g ) { do_something_with($1); } #### if ( my( @matches ) = $mystring =~ m/(regexp)/g ) { do_something_with( @matches ); }