3 ms·
They probably refer to how it has the top-level as <line-condition> { <code> } That's unusual enough among programming languages to call it odd. Being able
by jolmg 7y ago
They probably refer to how it has the top-level as
<line-condition> { <code> }
That's unusual enough among programming languages to call it odd. Being able to do stuff like
if (/some-pattern/) { ...
and have the regex be evaluated like a condition where it matches with the current line implicitly is also pretty unique.
- funkymike 7y agoif (/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.