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

help with the backtick operator

Thread Next
Matthew Weier O'Phinney
January 18, 2002 05:16
help with the backtick operator
Message ID:
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
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?


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About