Introduction to Perl

Lesson Two


This week, I decided to do a very basic script based on my pets...I was good and didn't name all of the ratties after the initial three. There have been close to 200, including the pups we've bred, and I didn't want this little script to explode...

#Script Week 2
#!usr/bin/perl

$title = "My Menagerie";
$author = "AJ";
$end = "And that\'s all she wrote.\n\nThe End.";

$user = "AJ";
$user2 = "Jenn";
$user3 = "Kate";

$cat = "George";
$cat2 = "Leo";
$cat3 = "Toby";
$cat4 = "Stasia";
$cat5 = "Harley";

$rat = "Art";
$rat2 = "Sammie";
$rat3 = "Janet";

system "cls"; # use "cls" for Windows/DOS
# system "clear"; # use for Linux/UNIX

print "\n$title\n\tby\n\t\t$author\n\n\n";
print "Once upon a time, $user and $user2 decided to get a pet.\n";
print "Their landlord wouldn't allow cats.\n";
print "So they got two rats, named $rat and $rat2, soon joined by $rat3.\n";
print "Those three rats were wonderful pets, and were eventually joined by many other rats, including a few that $user and $user2 bred themselves.\n";
print "Once $user and $user2 moved to Seattle, they were able to get cats.\n";
print "First there was $cat, who was owned by $user3.\n";
print "Then there came $cat2, who was $user2\'s cat, and $cat3, who was $user\'s cat.\n";
print "After $cat3 suddenly passed away, $user and $user2 adopted $cat5, who didn\'t work out, and $cat4, who is a bit paranoid.\n";
print "And now, $user and $user2 have $cat2, $cat5, 5 rats they've bred, and a mouse.\n\n";
print "$end\n";