2 ms·
Perl does have command-line options to do that :) perl -F: -lane '$total+=$F[2] if $F[2]>240; END{print $total}' /etc/passwd
by asicsp 9y ago
Perl does have command-line options to do that :)
perl -F: -lane '$total+=$F[2] if $F[2]>240; END{print $total}' /etc/passwd
- ajross 9y agoOf course it does, the implicit looping and BEGIN/END blocks (I'll concede I had actually forgotten about the implicit splitting) were in fact deliberately designed to emulate awk. Nonetheless I don't think that really changes the point much. The core language syntax is simple enough that perl one-liners can be written without that and still get the point across.