Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Perl Storybook, Part 2: Valentine's Day

by metaperl (Curate)
on Feb 12, 2005 at 00:55 UTC ( #430354=poem: print w/replies, xml ) Need Help??

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: poem [id://430354]
Approved by holli
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2023-12-05 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (25 votes). Check out past polls.

    Notices?