in reply to Is there an elegant way of resetting the match position?
If you use a lookahead regex, you can avoid resetting the position after every match. But the real issue (in my mind) is that you use $&, which incurs a significant performance hit. Here's a solution that produces the same output using lookaheads and substr:
#! /usr/bin/perl -w use strict; use warnings; my $a = "Input String: aaAabBAAa"; my $n = shift @ARGV; $n --; my $rx = qr/(.)(?=\1{$n})/i; while ( $a =~ /$rx/g ) { print substr( $a, pos($a)-1, $n+1), "\n"; }
print pack("A25",pack("V*",map{1919242272+$_}(34481450,-49737472,6228,0,-285028276,6979,-1380265972)))
In Section
Seekers of Perl Wisdom