What can I do using awk which I cannot do in Perl?

I read somewhere about one specific function that is present in awk but not in Perl. I could not find him again.

I would appreciate if anyone could point this out.

It might be a useless nonsense, but I'm still curious to find out.

+7
programming-languages awk perl
source share
4 answers

From perldoc perlvar :

Remember: the value of $/ is a string, not a regular expression. awk should be better for something. :-)

+18
source share

The awk to perl translator help page digs out one thing that Perl can't do:

  • Perl does not attempt to emulate awk behavior in which there are no non-existent elements of the spring array, simply by reference. (lvalue autovivification)

But overall, Perl is complete, it can do everything awk can do. The fact that an awk perl translator exists should be sufficiently proven :)

+8
source share

perltrap - Awk Traps lists a few differences between awk and perl .

See also: a2p - Awk to Perl translator

+4
source share

Regular expressions like

 /regex/ { awk code here } 

for pattern matching, this is a function that I skip from awk.

-2
source share

All Articles