sub get_df { my (@headers,@rows); # put each line the command returns into an array my @df = `df -Ph`; # the first element of the array contains the headers my $temp_df = shift @df; @headers = split (/\s+/, $temp_df); foreach (@df) { my @parsed_row = split (/\s+/, $_); unshift @rows, \@parsed_row; } return (\@headers, \@rows); }