don't use perl in perl, it gets too complicated with n times escaping characters, use perl directly!
open(FILE,"/v/region/na/appl/phoenixfunding/etl/data/qa/SessLogs/$wf_log");
while(<FILE>) {
chomp;
next if $_ !~ /Inserted/; # loops until a line with 'Inserted' is found, simulates the 'grep';
if ( /Applied: +(\d+)/ ) {
if ( $1 ) {
print "Yes, applied is greater than 0\n";
}
else {
print "No, applied is 0\n";
}
}
else {
print "there's no applied field here\n";
}
last; # this breaks the loop after the first loop, simulating the 'head -1'
}
close(FILE);