http://www.perlmonks.org?node_id=1230311


in reply to Re: A little golfing challenge: Replacing letters with numbers (edited)
in thread A little golfing challenge: Replacing letters with numbers

One longer variant, also with extra spaces, but with less than two of them on each line:
perl -pe 'ARNDBCEQZGHILKMFPSTWYV=~/$_(?{print pos.$"})/ for/./g,$_=$/'
Corresponding link. (upd. corrected a link)

And with similar idea but a bit shorter:
perl -pe 's/./ARNDBCEQZGHILKMFPSTWYV=~m!$&!&&"@+ "/ge'