TekWannaBe has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w format DISKSPACE = ($Filesytem,$kbytes, $used, $avail, $capacity, $Mounted_on) = split (/ + /); ====================== |@<<<<<<<<<<<<<<<<<<<| $FileSystem |@<<<<<<<<<<<<<<<<<<<| $kbytes |@<<<<<<<<<<<<<<<<<<<| $used |@<<<<<<<<<<<<<<<<<<<| $avail |@<<<<<<<<<<<<<<<<<<<| $capacity |@<<<<<<<<<<<<<<<<<<<| $Mounted_on ====================== . sub df_total { # if ($answer eq "F") { # write ($answer); open (DISKSPACE,">spaceavail.txt") || die "Error opening file spaceava +il.txt"; while (<DISKSPACE>) { chop; ($Filesytem,$kbytes, $used, $avail, $capacity, $Mounted_on) = split +(/ /); write (DISKSPACE); close (DISKSPACE) } } print "\n My First Perl Menu\n"; print "A. Current Date & Time\n"; print "B. Users currently logged in\n"; print "C. Name of working directory\n"; print "D. Contents of the working directory\n"; print "E. Names & Login names of user currently logged on to aries\n" +; print "F. Aries Disk Space Utilization\n"; print "Enter A, B, C, D, E, F: \n"; $answer = <STDIN>; chomp ($answer); if ($answer eq "A") { system "date \n"; } elsif ($answer eq "B") { system "who \n"; } elsif ($answer eq "C") { system "pwd \n"; } elsif ($answer eq "D") { system "ls -Fla \n"; } elsif ($answer eq "E") { system "finger \n"; } elsif ($answer eq "F") { system "df -k \n"; &df_total } else { print "The selection you entered: $answer, is incorrect. Please ent +er A, B, C or D \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Formatted Text
by Roger (Parson) on Jan 30, 2004 at 05:00 UTC | |
by TekWannaBe (Initiate) on Jan 30, 2004 at 16:41 UTC | |
by Roger (Parson) on Jan 30, 2004 at 23:58 UTC | |
|
Re: Formatted Text
by Anonymous Monk on Jan 30, 2004 at 08:35 UTC | |
|
Re: Formatted Text
by ysth (Canon) on Jan 30, 2004 at 09:03 UTC | |
by TekWannaBe (Initiate) on Jan 30, 2004 at 16:39 UTC | |
by ysth (Canon) on Jan 30, 2004 at 16:52 UTC | |
by TekWannaBe (Initiate) on Jan 30, 2004 at 17:05 UTC | |
by ysth (Canon) on Jan 30, 2004 at 18:18 UTC |