s/this/that/ s#this#that# s#this# "th" . "at" #e <-- the /e means (e)valuate the RHS before doing substitution # so the LHS of our RE is just this ^ begin string ( begin capture into $1 \d{16} 16 digits ) end capture into $1 # when we get a match of 16 digits at the begining of the string then we have 2 events. # first $1 contains them and # second the RHS of the RE gets evaluated. $_ = 1; # set a var to $1 so we can modify it (can't do to $1 as read only) tr/0-9/A-J/; # transliterate contents of $_ aka $1 $_; # perl will eval this with the net result that # our 'that' result is $_ which duly gets used # to replace our original digits