in reply to Perl Golf idea
Here is a summary of replies to this little informal golf contest. I hope there will be more replies.
- perl -e'sub w{join"",sort@_[0]=~/./g};$w=w pop;($w eq w$_)&&print for<>' ./dict.txt acert
- perl -E'sub w{[sort/./g]}$w=w$_=pop;$w~~w&&print for<>' ./dict.txt acert
- perl -nlE'sub w{[sort/./g]}INIT{$w=w$_=pop}$w~~w&&say' ./dict.txt acert
-
brx
perl -E'@a=sort pop=~/./g;print grep@a~~[sort//g],<>' ./dict.txt acert -
JavaFan, with the second argument getting printed (a dummy line must be added at the begining of dict.txt)
perl -nlE'sub w{[sort/./g]}$w||=w$_=pop;$w~~w&&say' ./dict.txt acert -
brx, with an extra newline after last line printed
perl -E'@a=sort pop=~/./g;say grep@a~~[sort//g],<>' ./dict.txt acert -
Update: thundergnat
perl -nlE'($w//=[sort pop=~/./g])~~[sort//g]&&say' ./dict.txt acert
In Section
Seekers of Perl Wisdom