On Thursday, May 23, 2002, at 02:29 , Lance Prais wrote:
[..]
> For example I ran the script and got the following output:
>
> E:\sea621\siebsrvr\BIN\perl\bin>perl emailmgr.pl
> Successfully Completed Email Manager Working Sleeping for 10
[..]
> else
> {
> print "Successfully Completed Email Manager Working";
> print substr($line, 105, 16);
> }
look at what you got out of the error message: a pretty
space between 'Working' and "Sleeping" -
hence why I of course would avoid trying to substr()
and go with a regular expression sequence....
my $found=0
my $target = 'Sleeping for 10';
while(<EMAILMGR>) { # hey you are walking till there anyway...
next unless(/$target/);
$found++; # increment our found flag
last; # bail out of while loop.
}
# worst case is we walked the file and the line is not there..
if ( $found ) {
# we found our prey do it...
} else {
# life is depressing, the prey got away
}
ciao
drieux
---
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]