Fellow Perl-Mongers:
I'm trying to break apart the command `df -k` data and display it into an html table:
Filesystem kbytes used avail capacity Mounted on /dev/dsk/c0t2d0s0 3008783 83669 2864939 3% / /dev/dsk/c0t2d0s3 4032654 886633 3105695 23% /usr /proc 0 0 0 0% /proc mnttab 0 0 0 0% /etc/mnttab fd 0 0 0 0% /dev/fd /dev/dsk/c0t2d0s7 19808378 250080 19360215 2% /var swap 594216 104 594112 1% /var/run swap 594448 336 594112 1% /tmp /dev/dsk/c0t2d0s6 1985487 532663 1393260 28% /export /dev/dsk/c0t2d0s5 1985487 356649 1569274 19% /opt /dev/dsk/c0t2d0s4 7057565 914628 6072362 14% /usr/local
Would anyone happen to know the best way to do this? I'm thinking of putting each line into an array...
Does anyone have any thoughts?
Consider using the Filesys::Diskfree module from CPAN.
What have you tried? Where did you fail? Getting each line into an array is simple since the backticks will return an array when called in list context. Of course I assume you have taint checking on, are using full paths to the executable, checking its return code properly, etc.
CGI.pm has methods for building tables dynamically you should read its docs.
perldoc -f split
Might also prove useful.
http://danconia.org
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>