Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$window->document->write("<BR> Hi.<BR> "); $window->document->write("Here is a try using a PerlScript.<BR> "); sub PrintWelcome { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(); $thisday=(Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday +)[$wday]; $thismon=(January,February,March,April,May,June,July,August,Septem +ber,October,November,December)[$mon]; if ($hour < 12) { $window->document->write( "Good morning! "); } elsif ($hour < 17) { $window->document->write( "Good afternoon! "); } else { $window->document->write( "Good evening! "); }; $ampm = 'AM'; if ($hour > 12) { $hour-=12; $ampm = 'PM'; } $time = sprintf '%d:%2.2d:%2.2d',$hour,$min,$sec; $year += 1900; $datetime = $time.' '.$ampm.', '.$thisday.', '.$thismon.' '.$mday. +', '.$year; $window->document->write("Just in case you were wondering, it's<BR +> "); $window->document->write($datetime); $window->document->write("<BR> <BR> Your username is $ENV{'USERNAME'} +(it\'s in \$ENV{'USERNAME'}), the computername is $ENV{'COMPUTERNAME' +} (it\'s in \$ENV{'COMPUTERNAME'}), and your OS is $ENV{'OS'} (it\'s +in \$ENV{'OS'}).<BR> "); $window->document->write("<BR> <BR> Here is everything in %ENV:<BR> ") +; foreach $key (sort(keys %ENV)) { $window->document->write("<BR> $key" . " = " . $ENV{$key} . "<BR> "); } my @rec = `ipconfig /all`; # print "@rec\n"; # to print out all of the command's output my $itemmac; foreach $itemmac (@rec){ #chomp $itemmac}; # to split line 12 of the above, up into fileds/one-words #my ($field1, $field2, $field3, $field4, $field5, $field6, $field7, $f +ield8, $field9, $field10, $field11, $field12, $mac) = split(/\s+/, $r +ec[13]); #print "Your MAC(Media Access Control)/Physical Address in hexadecimal + is: $mac\nThe first three bytes (e.g., 00-0A-CC) are the manufacture +r's code and can be used to identify the manufacturer.\nThe last thre +e are the unique station ID or serial number for the interface.\n"; $window->document->write("<BR> <BR>Your MAC(Media Access Control)/Phys +ical Address in hexadecimal is: $itemmac<BR> "); }; } PrintWelcome();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: remote perlscript
by liverpole (Monsignor) on Jan 21, 2007 at 16:21 UTC | |
|
Re: remote perlscript
by graff (Chancellor) on Jan 21, 2007 at 16:10 UTC | |
by Anonymous Monk on Jan 21, 2007 at 18:47 UTC | |
|
Re: remote perlscript
by johngg (Canon) on Jan 21, 2007 at 17:26 UTC | |
|
Re: remote perlscript
by EvanK (Chaplain) on Jan 22, 2007 at 00:49 UTC |