sub match_positions { my ($regexp, $sequence) = @_; use strict; my @positions = ( ); while ( $sequence =~ m/$regexp/ig ) { push ( @positions, pos($sequence) - length($&) + 1 ); } return "@positions "; }