3 ms·
if (/some-pattern/) { ... This isn't really unique when you consider perl. while (<>) { if (/pattern/) { This does the same. Awk simply has the implici
by funkymike 7y ago
if (/some-pattern/) { ...
This isn't really unique when you consider perl.
while (<>) {
if (/pattern/) {
This does the same. Awk simply has the implicit loop.
- jolmg 7y agoYes, I think Perl based that on Awk, but then those are the only 2 languages I know that support something like that. That's still very unique. On the implicit loop, along with Ruby, they're the only 3 languages I know that support something like that. That's also pretty unique, and Awk is the only one that has the implicit loop as a requirement.
- naniwaduni 7y agoThe implicit loop is uncommon among general-purpose langauges, but very common among filtering-centric languages like awk and grep and sed. For a more recent example, see jq. perl 5 may be close to the only mainstream general-purpose language to have embraced that paradigm though.