in reply to runnig part of script when variable changes

First of all, use strict and -w or warnings.

Now to the problem at hand. You don't give many specifics so the following code just checks to see if the value of $temp[1] changes from line to line in your file:
my $firstLineFlag++; my $sessid; while (my $line = <IN>) { my @temp = split (/[=]/, $line); if ($temp[1] > 100) { print "Session id: $temp[1] "; } if ($firstLineFlag) { $sessid = $temp[1]; $firstLineFlag = ''; } if ($temp[1] ne $sessid) { if ($temp[1] == 20) { print " V34\n\n "; } elsif ($temp[1] == 9) { print " no connection\n\n"; } $sessid = $temp[1]; } }

Replies are listed 'Best First'.
Re: Re: runnig part of script when variable changes
by splatohara (Novice) on Feb 21, 2002 at 14:50 UTC
    I am getting the error " can't increment in my at var.pl line x, near "++;"
      Really? Please post your code. I'm assuming the offending line is the my $firstLineFlag++; line which (if used as I posted) will just set the value of $firstLineFlag to 1.