On =>
Technically, => is a "funky comma". Yes, it is true that most of the time it is used for hash declarations, but you could use it for other purposes as well. And on the other hand, you can also declare a hash using
%a = ('key', 'value');
On qw
Let's use perlspeak. qw returns a list of scalars (that is then stored in an array). Also, the quoting is only used for perl to recognize the string. When perl stores the string in memory, the quotes are of course not used anymore.
@a = ('a', 'b', 'c'); @b = qw(a b c); # a and b contain the same elements %hash{key}++; %hash{'key2'}++; print "$_\n" foreach (keys %hash); # prints (not necessarily in this order): # key # key2
Does this clarify your problem?
Update: I didn't close my <b> tags, and I didn't use perlspeak myself -- perl uses lists rather than arrays. Thanks, Chmrr!
Update 2:
Chmrr says: Hrm -- it's not that perl uses lists rather than arrays; they're two different things, and perl has both. An array is @foo; a list is (1,2,3). Arrays are mutable, lists are not.
Never argue with a saint ;-). Yes, he's right. And I learned something new. Thanks!
In reply to Re: quoting style for lists
by crenz
in thread quoting style for lists
by erikprice
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |