in reply to search match within flat text file

basically whats happening is that $vchpage is getting set as "cat $tmp" what you proably want is something along this line
use strict; $tmp="some file"; open (FILE,"$tmp"); while(<FILE>) { if (/file error/i) {print "error in file";} else {print"@_ no error";} }
which basically opens up the file goes thru one line at a time

Replies are listed 'Best First'.
Re^2: search match within flat text file
by particle (Vicar) on May 31, 2002 at 01:45 UTC
    please use die or warn with open, or at least check the return status. otherwise you're lible to encounter subtle errors in your code.

    ~Particle *accelerates*

Re: Re: search match within flat text file
by grep (Monsignor) on May 31, 2002 at 01:31 UTC
    basically whats happening is that $vchpage is getting set as "cat $tmp"

    Nope - he's setting $vchpage to the result of the command 'cat filename'. ('cat' is like 'type' on M$/DOS - it lists the file to the STDOUT)

    The (backtick) ` operator returns the result of the command. It is not a quote operator like (quote) ' and (doublequote) ".

    This is explained on the perlop man page under Quote and Quote-Like operators



    grep
    These are not the monks you are looking for, move along