James Parsons wrote: > > Ok since I'm new to Perl I've written this fairly simple script to add > number from a text file, I have about 20-30 of these file with different > names and I would like to know how to add this to my script, I know how to > do it korn shell but in a perl script I'm really now sure, can anyone > point in the direction, Thanks for all your help.. > > script: > #!/usr/bin/perl -w > use strict; > > my $total = 0; > > open(FILE,"/usr/local/logs/onlines/mtd_temp") || die $!; # I have about 20 > mtd_temp1,2,3, etc > $total += $_ while(<FILE>); > > close(FILE); > > my $value = 100; > > $total = $total/$value; > > printf "\$$total\n",;
#!/usr/bin/perl -w use strict; my $file = '/usr/local/logs/onlines/mtd_temp' # I have about 20 mtd_temp1,2,3, etc @ARGV = grep /^\Q$file\E\d+$/, glob "$file*"; my $total; $total += $_ while <>; my $value = 100; $total = $total / $value; print "\$$total\n",; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]