in reply to Simple awk question

Perl doesn't know echo only print

What you seem to want is open with a pipe-symbol¹ to write to awk's STDIN.

Calling awk from Perl is somehow strange, though, Perl was primarily designed to replace awk and sed .

update

if you just wanna pass a handful of variables better use arguments in backticks

 my $result = `awk $var1 $var2`;

but I don't know much about awk (cause I don't need to ;-)

Cheers Rolf

(addicted to the Perl Programming Language)

¹) like in

open(my $awk, "|awk >Tmp$$") # $$ is our process id or die "Can't start awk: $!"; print $awk $var1, $var2; close $awk;

Replies are listed 'Best First'.
Re^2: Simple awk question
by RonW (Parson) on Jun 05, 2014 at 17:38 UTC
    Calling awk from Perl is somehow strange, though, Perl was primarily designed to replace awk and sed .

    For what it's worth, there is the a2p tool to convert AWK scripts into Perl. It can be helpful in transitioning to Perl from AWK.