Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Homework Golf

by atcroft (Abbot)
on Dec 04, 2013 at 06:06 UTC ( #1065539=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    # 3270 results in my /usr/share/dict/words file
    # First attempt, 97
    @c=split//;$v=0;foreach$s(@c){$s=lc$s;if($s=~/[a-z]/i){$v+=ord($s)-ord
    +('a')+1;}}print if($v==65);
    
  2. or download this
    # Second attempt: 88
    @c=split//;$v=0;foreach$s(@c){$s=lc$s;if($s=~/[a-z]/){$v+=ord($s)-96;}
    +}print if($v==65);
    
  3. or download this
    # Third attempt: 80
    @c=split//;$v=0;map{$v+=ord(lc($_))-96;}grep{/[a-z]/i;}split//;print i
    +f($v==65);
    
  4. or download this
    # Execute as perl -F'' -alne '$code' /usr/share/dict/words
    # Fourth attempt: 77
    $v=0;foreach$s(@F){$s=lc$s;if($s=~/[a-z]/){$v+=ord($s)-96;}}print if($
    +v==65);
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2021-08-01 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)








    Results (15 votes). Check out past polls.

    Notices?