[techtalk] Perl help needed

Lynn Kuhlman lynn at eskimo.com
Thu Jun 22 20:47:09 EST 2000


Help!
When I try to compile Converttags.pl I get the following error:

/\*\s**#ifdef   yeah
|*#ifdef   yeah
/: nested *?+ in regexp at converttags.pl line 15, <FILE2> chunk 13.


Here's the code:

Besides the regex problem I also think there is a looping problem as well. I
don't have a debugger at work so I'm blind.

Thanks,
Lynn

(Converttags.pl)
>
>
>#! /opt/perl/bin
>unless (@ARGV == 3)
>{
>  die "usage: converttags.pl infile tagfile outfile\n";
>}
>else
>{
>($file1, $file2, $file3) = @ARGV;
>open (FILE1, $file1) || die "I can't open $file1: $!";
>open (FILE2, $file2) || die "I can't open $file2: $!";
>open (FILE3, ">$file3") || die "I can't open $file3: $!";
>$count = 0;
> while ($string1 = <FILE1>) {
>  while ($string2 = <FILE2>) {
>   if  ($string1 =~ /\*\s*\$string2|\$string2/)
>   { $count++;
>     print FILE3 $string1;
>   }
>  } #end while
> if ( ($string1 =~ /\*\#endif|#endif/) && ($count > 0 ) )
> { $count--;
>    print FILE3 $string1;
> }
> elsif ( $count > 0 )
> { print FILE3 $string1;
> }
> } #end while
>
>(testfile)
>
> #ifdef SNS *
>junk
>junk
>#ifdef ken
>#ifdef don
>help
>me
>* junk *
>sando
>anderson
>#ifdef sam *
>more
>steve
>javascript
>#ifdef nicholas
>#ifdef jon
>hi
>there
>
>(testflags)
>
>#ifdef junk
>#ifdef hi
>#ifdef yes
>#ifdef ken
>#ifdef don
>#ifdef sure
>#ifdef my
>#ifdef hello
>#ifdef bye
>#ifdef beatles
>#ifdef megan
>#ifdef nicholas
>*#ifdef   yeah
>
>
>
>








More information about the Techtalk mailing list