f77coder has asked for the wisdom of the Perl Monks concerning the following question:
hello
in general if people could post some hellishly complicated one-liners, I'd like to have a go at trying to figure them out
no perl equivalent of fork bombs, thanks
:(){ :|:& };:
or
bomb() {
bomb | bomb &
}; bomb
Re: what are some of the most powerful, complex, one-liners?
by Athanasius (Archbishop) on Dec 08, 2016 at 06:59 UTC
|
16:56 >perl -wE "say s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))|\G\d{3}(?=\
+d))/$1,/gr for @ARGV;" 1234567 987654321098765
1,234,567
987,654,321,098,765
16:56 >
(The FAQ entry also has a commented version.)
Hope that helps,
| [reply] [d/l] |
Re: what are some of the most powerful, complex, one-liners?
by dave_the_m (Monsignor) on Dec 08, 2016 at 10:59 UTC
|
a quine I wrote a few years ago. Note that it uses no punctuation.
s zzs vvxv
and s ZVZchr 122Zie
and s ZVZchr 122Zie
and s ZVZchr 122Zie
and s SxSlcfirstSe
and s YZZxZYvvxvYi and print
z
and s ZVZchr 122Zie
and s ZVZchr 122Zie
and s ZVZchr 122Zie
and s SxSlcfirstSe
and s YZZxZYvvxvYi and print
Dave. | [reply] [d/l] |
Re: what are some of the most powerful, complex, one-liners?
by tybalt89 (Monsignor) on Dec 08, 2016 at 04:11 UTC
|
| [reply] |
Re: what are some of the most powerful, complex, one-liners?
by haukex (Archbishop) on Dec 08, 2016 at 07:45 UTC
|
Hi f77coder,
Many of these are not exactly one-liners, but figuring out some of these JAPH scripts (Update: also, super search, or of course) could be fun :-) This one is my relatively simple contribution:
perl -le "print map+chr 63+oct reverse,reverse+sort+0xbbddcb=~m~..~g"
There are actually lots of variations on the same principle, so naturally I wrote a generator script, these just a few examples of currently more than 2000 ;-)
perl -le "print map+chr 22+oct reverse,reverse+sort+0x21a111a=~m~..~g"
perl -le "print map+chr 23+reverse,sort+0xe8a8ea=~m~..~g"
perl -le "print map+chr -7+reverse,sort+(7*11*0xf7e9b)=~/../g"
perl -le "print map+chr 59+oct reverse,reverse+sort+(5*7*94_61*3**3*2*
+*3)=~/../g"
Regards, -- Hauke D | [reply] [d/l] [select] |
|
| [reply] |
Re: what are some of the most powerful, complex, one-liners? -- oneliner
by Discipulus (Canon) on Dec 08, 2016 at 15:03 UTC
|
| [reply] [d/l] [select] |
|
Thanks for the comments, i can bang out bash one liners but perl is a different beast, especially ones with hellishily complicated maps.
| [reply] |
Re: what are some of the most powerful, complex, one-liners?
by ExReg (Priest) on Dec 08, 2016 at 15:22 UTC
|
| [reply] |
Re: what are some of the most powerful, complex, one-liners?
by Phenomanan (Monk) on Dec 08, 2016 at 14:12 UTC
|
Why not just go to the Obfuscation page here on Perlmonks? There is plenty of insane code to try and crack there, although they are not necessarily one liners.
Check it out: Obfuscated Code
| [reply] |
|
Thanks, I'll have a look but intentionally obfuscated code is an order of magnitude harder it seems, I only want to look at shortened, compact code. Obfuscation is like adding an encryption layer, I'm not ready for that yet but thanks.
| [reply] |
Re: what are some of the most powerful, complex, one-liners?
by shawnhcorey (Friar) on Dec 08, 2016 at 14:27 UTC
|
| [reply] [d/l] |
Re: what are some of the most powerful, complex, one-liners?
by jdporter (Chancellor) on Dec 12, 2016 at 21:07 UTC
|
Just pick the most powerful module you know and invoke it as a one-liner. Just for one (not real great) example: Maypole::HTTPD:
perl -MMaypole::HTTPD -e 'Maypole::HTTPD->new(module=>"BeerDB")->run()
+'
I reckon we are the only monastery ever to have a dungeon stuffed with 16 ,000 zombies.
| [reply] [d/l] |
|
|