4) WHAT IS WITH THE STUPID SYMBOLS EVERYWHERE LARRY??!!
I'm not referring to the $ & @, I can see how they could be useful, although with a list -
@dude = (1, 2, 3), to obtain the 2nd value I would expect $d = @dude[1], not $d = $dude[1], that's counterintuitive also.
(I am an ex-perler gone clean. Been straight for 5 years now with only the occasional work forced binges.)
Perl was designed by a linguist. He wanted it to act like human language -- which is not very consistent.
That said, perhaps I can shed some light on the symbols.
Ever learned a Romance language? latin, spanish, french, etc? The dollars and at signs can be thought of in relation to plural endings.
$foo --> dog @dog --> a group of dogs $dog[0] --> a dog in the group
So when you mean "the whole group" use the plural spelling and when you want to refer to a member use the singular spelling. Likewise with other parts of the language.
Personally, the thing that keeps me away from Perl is nested datastructures.
Python:
my_list = [....] a_dict = {.....} b_dict = {.....} my_list.append(a_dict) my_list.append(b_dict)
if my_list[0].has_key("foo"): print "Yes"
easy. Try that in Perl.
my @my_list; # remember those semicolons my %a_dict, %b_dict; push @my_list, %a_dict; push @my_list, %b_dict; if (exists $my_list->[0], "foo") print "Yes\n"; # yes, references required, in Perl ick. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor