I really would like to make Perl accessible. Somehow giving someone the basics doesn't take being a Perl expert. You have to know something about education. College professors take no courses in education. They are not credentialed. They know too much and too little to teach first graders. The first grade teacher knows enough of the subject and enough of the person to get the job done right.
source code
%loves = (
"Tammy" => "Bob",
"Susan" => "Bill",
"Patricia" => "Marko"
);
%girls_house = (
"Tammy" => 'Schenectady, NY',
'Susan' => 'Yonkers, NY',
'Patricia' => 'Kinderhook, NY'
);
while (my ($girl, $boy) = each %loves) {
print "$girl loves $boy \n";
}
my %girlfriend = reverse %loves;
use Data::Dumper;
print Dumper \%girlfriend;
for my $boy (keys %girlfriend) {
print "$boy loves $girlfriend{$boy} \n";
}
use Data::Dumper;
print Dumper \%girlfriend;
for my $boy (keys %girlfriend) {
print "$boy loves $girlfriend{$boy} \n";
}
%vehicle = (
"Marko" => 'Station Wagon',
'Bill' => 'motorcycle',
'Bob' => 'Volvo'
);
for my $boy (keys %vehicle) {
print
"It is Valentine's day and $boy drove his
$vehicle{$boy} and went to visit $girlfriend{$boy}
in $girls_house{$girlfriend{$boy}} \n";
}
output
Patricia loves Marko
Susan loves Bill
Tammy loves Bob
$VAR1 = {
'Bob' => 'Tammy',
'Marko' => 'Patricia',
'Bill' => 'Susan'
};
Bob loves Tammy
Marko loves Patricia
Bill loves Susan
It is Valentine's day and Bob drove his
Volvo and went to visit Tammy
in Schenectady, NY
It is Valentine's day and Marko drove his
Station Wagon and went to visit Patricia
in Kinderhook, NY
It is Valentine's day and Bill drove his
motorcycle and went to visit Susan
in Yonkers, NY