[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> wrote:
: #!/usr/bin/perl : : ## Set pragmas (LC) and modules (UC) : : $^W = 1; If you are using a recent version of perl this is better. Read perllexwarn for details. use warnings; : use strict; This statement includes 'vars', 'subs', and 'refs'. : use strict 'subs'; This is redundant. : ## Begin Logic : : $ENV{"PATH"} = qq(/home/root:/usr/bin:/usr/sbin); : : my $w="40"; : my $total="0"; Avoid placing all variables at the beginning of the script. It tends to lead to unused variables in the script and variables which are scoped to larger blocks than necessary. Define them as you go. Also do not quote numbers. Avoid using variable names like $w which, BTW, is not unused. : my $outfile1 = qq(/home/root/tsm2_clients.out); : my $outfile2 = qq(/home/root/tsm2_clients.plout); : open (FF, "+<$outfile1") || die "could not open file: $outfile1 $!"; : open (FFF, "+<$outfile2") || die "could not open file: $outfile2 $!"; : : system qq(dsmadmc -id=admin -password=st0rm "tsm:select node_name : from nodes > $outfile1" ); : system qq(dsmadmc -id=admin -password=st0rm "tsm:select count(*) : node_name from nodes >> $outfile1" ); : # what happens when more nodes get added? my $total = 0; : while (<FF>) { : if ( $. > 6 ) { : if ( $_ !~ "ANR*" or $_ !~ "ANS*" ) { !~ is an operator for binding a regular expression. Do not use it with double quoted strings. Having no idea what is in $_, I can't tell you whether a regular expression or a different operator is needed here. : print FFF $_; : /^s+(\d+) $/ and $total +=$1; : } : } : } : print "Total Nodes on TSM1 and TSM2: $total\n"; : : close (FF) or warn "error closing $outfile1: $!"; : close (FFF) or warn "error closing $outfile2: $!"; : : : I tried the code give by John Krahn as hightlighted and this : did not work. Thanks though... any other ideas? "this did not work" is a pretty useless complaint. What happened which you didn't expect? What did you expect to happen? Where do you suspect a problem? HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>