my $cmd=sprintf("df -k %s |",$FILESYSTEM) #note the trailing pipe in the format open PIPE,$cmd or die "$cmd: $!"; my $junk=; # get rid of the first line.. it's junk. # # Could probably use /[\s]+/ but... my @df=split(/[\s\n\t]+/,) close PIPE; # done with this. my $df=$df[4]; #keep in mind the scalar $df is different than the array @df chomp $df; # just for grins $df =~ s/\%//g; # strip the % printf "File system %s is %d%% used\n",$FILESYSTEM,$df