Introduction to Perl

Introduction to Perl

Lesson Five

I had some serious issues with the various loop varieties this week and unfortunately just couldn't figure them out enough to make any real sense of them, so I gave up in the end. This course has taught me that Perl is just a little more involved than I honestly feel comfortable with. Hence, I also didn't do the EC.


#Script Week 5
#!usr/bin/perl

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

$aj = "36";
$jenn = "35";
$amy = "36";
$lj = "30";

if ($aj > 40) {
	print "aj won\'t be 40 for 4 more years.";
}	else {
	print "aj is turning 36 in less than a month.";
}

print "\n\n";

if ($aj > 40) {
	print "It must be at least 2010.";
} 	elsif ($aj < 30) {
	print "It must be 1998.";
}	else {
	print "It must be December 4th and AJ is 36 today.";
}

print "\n\n";

if ($jenn <= 30) {
	print "Did you know Jenn is 30?";
	print "Only if this is the year 2000."
}

unless ($amy eq 36) {
	print "It isn\'t Amy\'s birthday yet, is it?";
}

$me = 15;
$kipp = 0;

until ($me <= 20) {
	$age = $me++;
	$kage = $kipp++;
}

@pets = qw(Leo Stasia Wolverine Storm Phoenix Shadowcat Chance Lizzie);

foreach $pet (@pets) {

   print "$pet\n";
   $count++;

}

print "Fait accompli...I printed all $count of my current pets!\n\n";