3 ms·
Compared to Ruby, one liners are more efficient in Perl because the normally infuriating cryptic variables and defaults save space. For example in Perl you can
by mapgrep 15y ago
Compared to Ruby, one liners are more efficient in Perl because the normally infuriating cryptic variables and defaults save space. For example in Perl you can run a foreach without naming the current iteration value and it defaults to $_. $_ in turn is the default target for many commands, like print.
So Perl's `print foreach @a` becomes Ruby's `a.each{|a| print a}`. Not so bad but it adds up.