while ( $sequence =~ /$regexp/ig ) { push ( @positions, pos($sequence) - lenght($&) +1); }