Apparantly not.
What the 'if' statement was SUPPOSED to do is to check if it had found a hit
and, if it did, replace the string. If it didn't, it is simply supposed to
write the line out to the temp file and move on. That is obviously NOT what
it is doing it seems. How would YOU structure this statement? Also, what
tool are you using to evaluate the code? I'm using Visual SlickEdit but it
would be nice to be able to do something like what you just did.

Thanks!
Anthony

----- Original Message -----
From: "Nikola Janceski" <[EMAIL PROTECTED]>
To: "'Anthony Saffer'" <[EMAIL PROTECTED]>; "Perl Beginners List"
<[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 8:04 AM
Subject: RE: Question about Error


> Are you sure you know what this 'if' statement is doing?
> It always evaluates true. and the m/$litem/$matchitem/i shouldn't be in
> quotes.
>
>     if($litem, "/$matchitem/"){  ## always true
>      $PNdString =~ "m/$litem/$matchitem/i";  ## not a pattern match if
it's
> in quotes
>      print (OUTFILE "$PNdString\n");
>     }
>     else{
>      print(OUTFILE "$litem\n");
>     }
>
> > -----Original Message-----
> > From: Anthony Saffer [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 18, 2002 9:04 AM
> > To: Perl Beginners List
> > Subject: Question about Error
> >
> >
> > Good Morning Everyone,
> >
> > Got another question: I wrote my first Perl script last night
> > and it seemed to be error free on Windows. But when I
> > uploaded it to Linux (RH 7.3) it threw an error that I don't
> > understand. From a Google search it seems there could be a
> > number of problems and I am not experience enough to know
> > which. The error I am getting is:
> >
> > Nested quantifiers before HERE mark in .... then it gives my
> > regular expression followed by the first line of the file.
> >
> > I THOUGHT this code was right. But obviously it isn't. Can
> > someone tell me why line 29 would be throwing this error or
> > WHAT the error means? The entire code is below. Thanks again
> > for all the help. This list has been a lifesaver.
> >
> > Anthony
> >
> > CODE:
> >
> > my $PNdString = "";
> >
> > sub process_files{
> >  open(FH, "< $_") or die("Error! Couldn't open $_ for
> > reading!! Program aborting.\n");
> >  open(MTH, "< /home/losttre/sorted.txt") or die("Error!
> > Couldn't open $MTH for reading!\n");
> >  open(OUTFILE, "> temp.dat") or die ("Couldn't open temp
> > file! Aborting\n");
> >
> >  @MTH = <MTH>;
> >  @fcontents = <FH>;
> >
> >  foreach $matchitem (@MTH){
> >   foreach $litem (@fcontents){
> >    if($litem, "/$matchitem/"){
> >     $PNdString =~ "m/$litem/$matchitem/i";
> >     print (OUTFILE "$PNdString\n");
> >    }
> >    else{
> >     print(OUTFILE "$litem\n");
> >    }
> >   }
> >
> >  }
> > print "Done\n";
> > }
> >
> > find(\&process_files, @ARGV);
> >
> >
>
> --------------------------------------------------------------------------
--
> --------------------
> The views and opinions expressed in this email message are the sender's
> own, and do not necessarily represent the views and opinions of Summit
> Systems Inc.
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to