Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Shorten this one-liner!

by LanX (Saint)
on Aug 25, 2018 at 21:56 UTC ( [id://1221106]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    c:\Perl_524>perl -anE"/a/&&say$_,' :'.y/$_/e/for@F"
    anyone cnacel declare perlmonks
    anyone :0
    cnacel :0
    declare :0
    
  2. or download this
    c:\Perl_524>perl -anE"/a/&&say$_.' :'.y/e/e/for@F"
    anyone cancel declare perlmonks
    anyone :1
    cancel :1
    declare :2
    
  3. or download this
    c:\Perl_524>perl -anE"/a/&&say$_.' :'.y/e//for@F"
    anyone cancel declare perlmonks
    anyone :1
    cancel :1
    declare :2
    
  4. or download this
    use feature 'say';
    while (<>) {
        @F = split(' ');
        /a/ and say $_ . ' :' . tr/e// foreach (@F);
    }
    
  5. or download this
    ~$ perl -anE'/a/&&say"$_ :".y/e//for@F'
    anyone cancel declare perlmonks
    anyone :1
    cancel :1
    declare :2
    
  6. or download this
    $ perl -E'/a/&&say"$_ :".y/e//for qw/anyone cancel declare perlmonks/'
    anyone :1
    cancel :1
    declare :2
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found