Here are some simple scripts to illustrate the "look" of a Perl program.
Code:
# file: message.pl print "When that Aprill with his shoures soote\n"; print "The droghte of March ath perced to the roote,\n"; print "And bathed every veyne in swich licour\n"; print "Of which vertu engendered is the flour...\n"; |
Output:
(~) 50% perl message.pl When that Aprill with his shoures soote The droghte of March ath perced to the roote, And bathed every veyne in swich licour Of which vertu engendered is the flour...
Code:
# file: math.pl print "2 + 2 =", 2+2, "\n"; print "log(1e23)= ", log(1e23), "\n"; print "2 * sin(3.1414)= ", 2 * sin(3.1414), "\n"; |
Output:
(~) 51% perl math.pl 2 + 2 =4 log(1e23)= 52.9594571388631 2 * sin(3.1414)= 0.000385307177203065
Code:
# file: system.pl system "ls"; |
Output:
(~/docs/grad_course/perl) 52% perl system.pl index.html math.pl~ problem_set.html~ what_is_perl.html index.html~ message.pl simple.html what_is_perl.html~ math.pl problem_set.html simple.html~
Code:
# file: time.pl $time = localtime; print "The time is now $time\n"; |
Output:
(~) 53% perl time.pl The time is now Thu Sep 16 17:30:02 1999
|
| Contents |
Next |