http://www.perlmonks.org?node_id=522060


in reply to trying to convert from awk to perl

The problem you are suffering from is that fact that the backticks are an interpolative context. Which means that the $1 you have is interpolated before the call to awk is made. And you have the same for the $0. Putting backslashes before the dollar signs will solve this problem.

However, it doesn't make sense to use backticks here. Backticks run the command, and return the output of the command - however, since your command redirects all output, there's nothing to collect. The following system command you make doesn't make sense - it executes nothing. You'd be better off to use system here, instead of the backticks - and then you can q and avoid $1 and $0 to be interpolated:

system q {awk '$1 ~ /^F/ {print $0 }' /tmp/frhtest/ADDC.bak > /tmp/frh +test/ADDC.}.$date; die "Command failed" if $?;
Perl --((8:>*