develooper Front page | perl.beginners | Postings from January 2002

help with the backtick operator

Thread Next
From:
Matthew Weier O'Phinney
Date:
January 18, 2002 05:16
Subject:
help with the backtick operator
Message ID:
20020117031048.51664.qmail@onion.perl.org
I'm trying to call egrep from a perl script using the backtick operator
-- I need to parse the output from egrep to see if additional information
is contained, something like:

$parseFile = `egrep -d skip \\<form\s*.*?action\s*=\s*\"?someFile.html
2>/dev/null`
if ($parseFile =~ /method\s*=\s*\"?post/ ) { do this; }

(I realize I could probably write a comprehensive regular expression, but
I have other reasons for doing this...)

Basically, I have the following question(s) about the backtick operators:
In a scalar string context, will  a shell command called by the backtick 
operator  return ALL lines? i.e., if egrep returns multiple lines, will 
$parseFile contain all the lines? I know that in a list context, each item
in the list will contain a single line -- but can it work this way as well?

Thanks,
Matthew

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About