Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Do you know where your variables are?
 
PerlMonks  

Re: Perl Golf idea

by brx (Pilgrim)
on May 02, 2012 at 13:41 UTC ( #968452=note: print w/ replies, xml ) Need Help??


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.

  • thundergnat

    perl -e'sub w{join"",sort@_[0]=~/./g};$w=w pop;($w eq w$_)&&print for<>' ./dict.txt acert
  • tobyink

    perl -E'sub w{[sort/./g]}$w=w$_=pop;$w~~w&&print for<>' ./dict.txt acert
  • JavaFan

    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


Comment on Re: Perl Golf idea
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://968452]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2014-04-21 15:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (495 votes), past polls