#alphabet @alpha = split '', 'G;_0x}snafuU='; @list = split '', 'snafu_G0}U'; s(\@alpha,\@list); # prints # G,_..0,}..U # or if it is easier to , a run of 2 # G,_,0,}..U