I would guess you are looking in the wrong place or you transcribed the code
incorrectly.  The code below has a syntax error so it won't run at all.  I
tested with the following.  I made some changes but nothing that would
remove a syntax error.  Notice the use of -w and use strict.

        #perl -w
        use strict;
        my $equal = 0;
        my $in = 0;
        my $out = 0;

        open(FILEIN, "test.txt");
        while (<FILEIN>) {
                chomp;
                $in++;
                next if ( /^\s*#/ or /^\s*$/ );
                if ( /^=(.+)/ ) {
                        my $info = $1;
                        ($equal = 0) if ( $info =~ /cut/ );
                        ($equal = 1) if ( $info !~ /cut/ )
                }
                next if ( $equal );
                $out++;
        }  # end of main while loop

        print "in=$in\n";
        print "out=$out\n";
-----------test.txt--------------------------------------
        =cut = 1
        =cut = 2
        =up = 3
        =down = 4
        =cut = 5

> On Behalf Of Wagner-David
>
> I get the following warning:
>
> Useless use of subtraction in void context at
> c:\currwrka\00commonperl\03aaplxxx \aapl082.pl line 119.
>
>       when this code :
>       if ( /^[\=](.+)/ ) {
>
>   in the following context is run(version: 5.005_003). I have
> tried a number of different things(ie ^\=(.+) ), but always end
> up with the above message. What am I doing wrong?
>
>       I just trying to count lines of actual code verses blank
> lines and comments. Using start of line =xxxx as a flag to skip
> code and  start of line =cut to restart counting.
>
>       Thanks for the assistance.
>
> Wags ;)
>
>

> -------------------------------------------------------------------  ]]
>
> Code snippet:
>
>     my $equal = 0;
>
>     INPUTTM: while (<FILEIN>) {
>         chomp;
>         $in++;
>         next INPUTTM if ( /^\s*#/ or /^\s*$/ );
>         if ( /^[\=](.+)/ ) {
>            my $info = $1;
>            $equal = 0 if ( $info =~ /cut/ );
>            $equal  1 if ( $info !~ /cut/ )
>          }
>         next INPUTTM if ( $equal );
>         $out++;
>      }  # end of main while loop
>


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to