I don't know if anyone is still bothering to check these forums, as they apparently never seemed to get much activity in the past, but heres my solutions for the exercises at the end of ch03:
Array Exercise:
Code:
#!/usr/bin/env perl
use strict;
use warnings;
use diagnostics;
my @karray = qw( Andrew Andy Kaufman );
my $andrew = $karray[0];
my $andy = $karray[1];
my $kaufman = $karray[2];
print qq($andrew "$andy" $kaufman\n);
Hash Exercise:
Code:
#!/usr/bin/env perl
use strict;
use warnings;
use diagnostics;
my %fruit = (
bananas => 'yellow',
apples => 'red',
grapes => 'green',
);
for my $produce ( keys %fruit ) {
print qq($produce are $fruit{$produce}\n);
}
I would be very interested as to alternate ways to solve these simple problems, this being perl and all, theres more than one way to do it...