Anthony Saffer wrote:
>
> Good Morning Everyone,
Hello,
> 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{
It appears that you are using this sub with File::Find::find which means
that you are opening these files every time find() finds a file however
the files '/home/losttre/sorted.txt' and 'temp.dat' only have to be
opened once so they should be opened outside of the subroutine..
> 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/"){
Do you define $matchitem as a substring of $litem or are they supposed
to be exactly the same?
if ( $litem eq $matchitem ) { # exactly the same
if ( $litem =~ /$matchitem/ ) { # $matchitem is a substring
> $PNdString =~ "m/$litem/$matchitem/i";
I'm not sure what you are trying to do here??
> print (OUTFILE "$PNdString\n");
> }
> else{
> print(OUTFILE "$litem\n");
> }
> }
> }
> print "Done\n";
> }
>
> find(\&process_files, @ARGV);
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]