There are other significant other functionalities that I find very handy in oneliners, notably:
- automatic associative array instantiation
- the return value of regular expressions with a capture group is the value matched by it (in Ruby, the closest to this is `[/regex/, <group_i>]`)
Re:Ruby One-Liners
by Maledictus on Saturday September 14, 2019 @02:26AM
(#20969267)
I can't stand weak types, so I prefer Ruby even if it is a little longer. Thanks for pointing this out.
There's plenty of stuff that is similar to Perl, which in turn had borrowed from awk, sed and other tools. The biggest difference I'd pick is Perl's context based operation.
Performance is slower compared to Perl, but to those who already know Ruby, this would suit better than learning the nuances of another language.[1] https://github.com/learnbyexample/Command-line-text-processi...