Open both files
Read each line from the first file
Split it into mount point, total space, used space, free space
Do the same for the second file
Compare matching mount points to see the differences.
####
open( my $firstfile, '[0] is the total
# $first_machine{$mount_point}->[1] is the used
# $first_machine{$mount_point}->[2] is the free
# Similar for $second_machine.
# Print here after doing calculation.
}
else {
print "No mount point corresponding to $mount_point on the second machine.\n";
}
}
sub consume {
my ($filehandle) = @_;
my %result;
while ( defined($_ = ) ) {
chomp;
next unless /dev/;
($mount_point, $total_space, $used_space, $free_space) = split;
$result{$mount_point} = [$total_space, $used_space, $free_space];
}
return %result;
}