in reply to Removing recurring consecutive element

I assume it is a typo, but you are not using the $aref that you are passing to the sub, and instead working directly on $tpl.

s-t


sub sk{ return unless $in = shift; $in =~ s!(.)$!!; print $1; sk($in)} sk("gro.alubaf@yehaf");