Hi, I've just about solved the problem for you... I am obviously a student with too much time on his hands ;-) However, it is fairly complicated for a beginner example, but should be quite interesting for the more experienced "beginner" (like me :)
The line with 'split' is what you are looking for, a simple variation would be: my $capacity = (split /\s+/)[4]; I hope you can follow what is happening, at least in a primative sense. I didn't bother to sort the devices, since this is a hard thing to do correctly. If anything, learn that you can create concise and readable(?) scripts. Take care, Jonathan Paton --- PERL SCRIPT STARTS HERE --- #!/usr/bin/perl -w use strict; # Call df function for filesystem information my %df = %{ df() }; # Check capacity while (my ($device, $data) = each (%df)) { my $capacity = $data->{capacity}; do_something($device, $capacity) if (90 < $capacity); } # Do something about being full sub do_something { my ($device, $capacity) = @_; print "Warning: Device $device has just $capacity\% left!\n"; } # Extract information from df # and return a hash reference to data sub df { # Create hash for all the data retrieved from df my %df; # Call and process output of df foreach( qx(df -k) ) { # Skip non-data lines next if /^File/; # Extract data from this row my ($device, $blocks, $used, $available, $capacity, $mountpoint) = split /\s+/; # Remove newline chomp($mountpoint); # Remove percent symbol $capacity =~ s/\%.*//; # Stuff an anonymous hash containing row data into %df $df{$device} = { "blocks" => $blocks, "used" => $used, "available" => $available, "capacity" => $capacity, "mountpoint" => $mountpoint }; } return \%df; } --- PERL SCRIPT ENDS HERE --- __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]