Some help understanding this program would be greatly
appreciated! I'm really struggling with this perl
language!
Thanks,
siegfried
my $x= {'d' => 'y', 'f' => 'g'},
$y = ['a', 'b', 'c', 'd'];
# This works! Good!
foreach my $i (@{$y}){ print "array i = $i\n" }
# (1) Why does not this work? How do I index an array?
# (2) How do I compute the length of y instead of hard
coding 3?
for(my $i = 0; $i <= 3; $i++) {
print "y[$i] = "[EMAIL PROTECTED]"\n";
}
# $i receives the proper values
foreach my $i (keys %{$x}) {
# (4) Why does not this work? How do I index into my
hash?
print "hash i = $i => ".$x{$i}."\n";
}
my %z= ('d' => 'y', 'f' => 'g');
foreach my $i (keys %z) {
# (5) Why does $z work instead of %z here?
print "z{$i} = $z{$i}\n";
}
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]