P is for Practical | |
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?? |
Update: Code shown is based on the last one-liner of the OP which was case sensitive. For case insensitivity replace /a/ with /a/i and y/e/.. with y/eE/.. in the following examples.
For a start, I tried this but am failing to call tr (aka y) in scalar context.
updateI misread the docs for tr, is this good enough?
note: you have to enter more lines or kill the one liner with C-c
updateone char less!
explanation: this is equivalent
see also perlrun for -a, -n and -E (though it claims "-a implicitly sets -n" which I can't reproduce)
Cheers Rolf
updateeven less under linux
updatelast but not least without reading from STDIN (which doesn't make much sense for a one-liner)
In Section
Seekers of Perl Wisdom
|
|