|
|
|
|
|
by patio11
4462 days ago
|
|
Awk is even shorter: anything truthy works. You don't even need the print statement or brackets. Thus there are nine separate 1-byte programs which produce cat: [1], [2], [3], etc etc. By default, unless you use the BEGIN block or something, awk will run your program on each line of stdlin. This is useful for programs of the type: (/some regular expression/) { some action} The default action if you don't specify one is "print $0" (the whole matching line). If your condition is a plain-ol' expression rather than a regular expression, and it always evaluates truthy, you thus get every line. |
|
Still the shortest Perl is 0 bytes when the command line switch is allowed to be -p
Update: That's actually called "the sed mode of Perl." Moreover these two command lines behave similarly:
and