in reply to Double check for positions

#!/usr/bin/perl # http://perlmonks.org/?node_id=1201579 use strict; use warnings; my $haystack = 'AGCTTCTTGCTTCTTGC'; my $needle = 'GCTTCTTGC'; my @positions; push @positions, $-[0] + 1 while $haystack =~ /(?=$needle)/g; print "@positions\n";