The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Letting go of brackets is hard if you come from the C
school of bondage and discipline programming, where forgetting
something minor, like brackets on a function call, is
punishable by death ("Segmentation fault.").
When declaring arguments, I have found that the code looks strange, inconsistent, and a little off-kilter when mixing and matching declaration styles, where 'off-kilter' is a euphemism for "looks broken": Any statement like 'my $count = @_' can make me feel a little bit dizzy, if only because it seems like anything could happen there (i.e. concatenation with spaces, concatenation without, first element assignment, last element assignment, count of items, index of last item, etc.). Instead, I would rather explicitly specify what is intended as 'my ($count) = scalar (@_);', though rumor would have it that 'scalar' is deprecated. Anyway, maybe I'm just behind the times. I use brackets on int() and join(). I'll admit it! Maybe it's curable. As long as I'm careful to make sure that my assignments are array-safe (as I don't want to go to jail) then things work okay, in their own wacky way, and everything is bracketized and compartmentalized neatly. So, I can only suppose that you would prefer the following mutant variation, suggested for fun:
In reply to Re: scalar my vs list my
by tadman
|
|