Does anyone know of any reason why => might be used in place of , in this instance?There's no particular reason apart readability/psychological feeling. Here you have a large structure applied -this is the keyword!- by bless to the class you want to bless it into. You often use => instead of , when you want to stress that the term on the left is applied or associated to that on the right.
I had always assumed that => stringifies its left operand, but a little testing, seems to indicate it only actually stringifies if it thinks the left operand is a word... i.e. not a $var - subtle!Indeed it stringifies only in a few situations and in some cases this has led to confusion.
Incidentally, it may be a matter of personal preference/style, but this:
is deprecated by many kwnoledgeable OO Perl hackers.return bless my $self = {}, (ref $class || $class); # ^^^^^^^^^^^^^^^^^^^^^^
In reply to Re: bless with => separated args
by blazar
in thread bless with => separated args
by jaa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |