country1 has asked for the wisdom of the Perl Monks concerning the following question:
I am relatively new to perl and while running a perl script I got the following error message and I was hoping that someone might be able to help me to understand what the message is and what I might do to correct it. The message is:
Cant close file GLOB(0x18d8ec): No space left on device at PSA_Solaris +_Combined_Script.pl line 98.
The PSA_Solaris_Combined_Script.pl code is as follows:
#!/usr/bin/perl use strict; use warnings; ###################################################################### +## # # PSA_Solaris_Combined_Script.pl # # Combined Script to Produce Measured/Attributed Report for a # Requested Month (Solaris servers) # # Execution requires 3 arguments # 1) Directory where PSA Monthly Accounting files reside # 2) File Specification string # 3) Date Required - in "mm/yyyy" format # 4) Date Wanted in Output File Names mmmyy format where mmm is 3 o +r 4 letter # # Example: # On xsd00z02 #perl PSA_Solaris_Combined_Script.pl /shared/imd/acct "xsd*.*" "07/200 +7" "Jul07" # ###################################################################### +## ###################################################################### +## # # Originally readdpsa.pl # readdpsa.pl - perl script to read a directory and multiple monthly # PSA Accounting Reports # ###################################################################### +## ## system("rm PSASolaris1.tab"); my $directory = $ARGV[0]; my $filespec = $ARGV[1]; my $datewant = $ARGV[2]; my $datefile = $ARGV[3]; my $SORTFILES; my $index; my $offset; my $count; ## my %usage; my $files = 0; my @SORTFILES; opendir DIR, $directory or die "can't open $directory: $!\n"; my @FILES = glob("$directory/$filespec"); @SORTFILES=sort(@FILES); $count = @SORTFILES; ########################################################## # # Read All Files In Directory to Find Those That Match Date # ########################################################### foreach $SORTFILES (@SORTFILES) { my $date; my $server; my @data; open (my $fh,'<',$SORTFILES) or die "Cant open file $SORTFILES: $!"; open (my $SORT,">>","PSASolaris1.tab") or die "Can't open sort output +file: $!"; while (my $line = <$fh>) { chomp($line); next if ($line =~ /^$/ ); # skip if line begins with spaces last if ($line =~ /TOTAL COMMAND SUMMARY/); if (($line =~ /MONTHLY USAGE FOR/) and ($. < 4)) { $offset = index($line,"MONTHLY USAGE FOR"); $date = substr($line,$offset+18,7); $server = substr($line,$offset+30,8); last if ($date ne $datewant); } last if ($date ne $datewant); next unless $line =~ /^\d/; # $line begins with a digit push @data, $line; my @sorted = map { $_->[0] } sort { $a->[1] cmp $b->[1] } map [ $_, (split)[1] ], @data; # Sort by Login print $SORT "$server\t$date\t$_\n" for @sorted; } ## END of while loop continue { $files++ if eof; } close $fh or die "Cant close file $SORTFILES: $!"; close $SORT or die "Cant close file $SORT: $!"; } ## END of foreach loop closedir DIR;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error Message in Closing File
by derby (Abbot) on Sep 19, 2007 at 12:00 UTC | |
by grinder (Bishop) on Sep 19, 2007 at 14:20 UTC | |
|
Re: Error Message in Closing File
by jwkrahn (Abbot) on Sep 19, 2007 at 16:18 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |