This one is wrong (only) if the first line of 'dict.txt' contains a valid word (different from arg2).
example:
$ cat dict.txt one neo noe bad $ perl -nlE'sub w{[sort/./g]}$w||=w$_=pop;$w~~w&&say' ./dict.txt oen oen neo noe
First word is missing. Anyway, this is a very beautiful version: ++
UPDATE: with an extra newline
perl -E'@a=sort pop=~/./g;say grep@a~~[sort/./g],<>' ./dict.txt acertUPDATE2: one char useless
perl -E'@a=sort pop=~/./g;say grep@a~~[sort//g],<>' ./dict.txt acertIn reply to Re^4: Perl Golf idea
by brx
in thread Perl Golf idea
by sweepy838
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |