@matcher = qw'2 4 4 2 5 4' ; foreach $crypted (@result ) { $x = pop @matcher ; $crypted =~/..(.{$x}).*/g ; push @final, $1 ; }