All,

Just like to ask for correction on what's wrong with my script it gives spit 
out this error when i run it.

Unsuccessful open on filename containing newline at disksize.pl line 8.
Can't open file No such file or directory

But it runs without this error whenever i feed it up when an existing file 
output by df-h.
ex:## open(FL,"path/toactual/file") or die "blabalha";
Does this mean it can't trap the output of  `df-h`?

Here's the script###

#!/usr/bin/perl

use strict;
use warnings;

chomp(my $output_file = `df -h`);

open(FL,"$output_file") or die "Can't open file $!\n";
my @list;
my %disk;
my($label,$size,$use,$avail,$percent,$mounted,$partition,$usage);
while(<FL>) {
     ($label,$size,$use,$avail,$percent,$mounted) = split(/\s+/, $_);
     push @list,$mounted,$percent;
}

%disk =(@list);
delete $disk{"Mounted"};



foreach (sort keys %disk) {
       my $value = $disk{$_};
       print "\t $_ => $value \n";
}




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to