Mike Singleton wrote at Mon, 09 Sep 2002 19:19:22 +0200:
> I think that I have bit off more than I can chew here....
I hope, it's O.K., if I'll give some other hints:
> ...
> my $HELP="
> <description>:
>
> This script must be run on the Backup Express master server.
> ....
> ";
You could also use a HERE document:
my $HELP = <<END_OF_HELP;
<description>:
This script must be run on the Backup Express master server.
...
END_OF_HELP
That avoids the escaping of " and it's often easier to detect
where the string finishes.
Especially if there's no syntax highlighting.
> ...
> my %statcode =
> ( "$JOBEND" => '0',
> "$CONDEND" => '0',
> "$JOBFAIL" => '-1',
> "$JOBCANC" => '-2',
> );
perldoc -q 'What's wrong with always quoting "$vars"?'
BTW: You use a lot of constants.
Perhaps you should have a look to the constant pragma.
>
> open (OUTF,">$OUT_TEMP") || die "Cannot open output file $!";
> my @files = glob('3*.log');
> $grepexpr = "egrep
> \"$JOBSTART\|$CONDSTART\|$JOBEND\|$CONDEND\|$JOBCANC\|$VOLUSED\"
> @files>$OUT_TEMP";
> system "$grepexpr";
You could also let Perl do the grep job:
local @ARGV = @files;
while (<>) {
print OUTF if /$JOBSTART/ ||
/$CONDSTART/ ||
/$JOBEND/ ||
/$CONDEND/ ||
/$JOBCANC/ ||
/$VOLUSED/;
}
> ...
> $starttime{$current} = $line[2] . " ";
> $starttime{$current} .= $line[3] . " ";
> $starttime{$current} .= $line[4] . " ";
> $starttime{$current} .= $line[5] . " ";
> $starttime{$current} .= $line[6];
or shorter (and quicker)
$starttime{$current} = join " ", @line[2..6];
Greetings,
Janek
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]