Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Shorten this one-liner!

by Marshall (Canon)
on Aug 25, 2018 at 23:28 UTC ( [id://1221107]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use warnings;  
    ...
    cancel 1
    declArE 2
    pal 0
    
  2. or download this
    my @words = ("anyone", "cancel", "declArE", "perlmonks", "pal");
    print "$_: ",tr/eE//, "\n" for grep{tr/aA//;}@words;
    
  3. or download this
    words = ["anyone", "cancel", "declArE", "perlmonks", "pal"]
    print(*((word,word.upper().count('E')) for word in words if 'A' in wor
    +d.upper()))
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found