- or download this
use strict ;
use warnings ;
...
foreach ( @F ) {
print( ($ar[ord $_] // $_ ) . " " ) ;
}
- or download this
perl '-M5;@ar[map { ord } split "","\0ARNDBCEQZGHILKMFPSTWYV"] = 0..12
+7' -alpe '($_=$F[0])=~s/(.)/($ar[ord $1])." "/ge' input.txt
# or
perl '-M5;@ar[map { ord } split "","\0ARNDBCEQZGHILKMFPSTWYV"] = 0..12
+7' -alpe '($_=$F[0])=~s/(.)/(defined $ar[ord $1] ? $ar[ord $1] : $1 )
+." "/ge' input.txt
- or download this
# 'defined' is optional:
perl '-M5;@ar[map { ord } split "","\0ARNDBCEQZGHILKMFPSTWYV"] = 0..12
+7' -alpe '$_=~s/(.)/(defined $ar[ord $1] ? $ar[ord $1]." " : $1 )/ge'
+ input.txt
- or download this
perl '-M5;@ar[map { ord } split "","\0V\0B\0L\0\0\0Q\0\0\0\0\0\0\0E\0\
+0\0\0\0\0\0\0\0\0P\0\0I\0\0\0\0\0\0Z\0H\0\0\0\0\0\0\0\0Y\0J\0\0S\0\0\
+0\0\0D\0\0\0X\0\0\0\0\0K\0\0\0R\0\0\0\0W\0\0\0\0\0U\0\0\0\0A\0\0M\0\0
+\0F\0\0\0C\0\0T\0\0\0\0O\0\0\0\0\0\0\0\0\0\0N\0G\0\0\0\0"] = 0..127'
+-alpe '$_=~s/(.)/($ar[ord $1] ? $ar[ord $1]." " : $1 )/ge' input.txt