|
|
| There's more than one way to do things | |
| PerlMonks |
Re: new keyword "size" to avoid scalar trap ? ( scalar @array != scalar(LIST) )by moritz (Cardinal) |
| on Dec 07, 2012 at 17:06 UTC ( #1007798=note: print w/ replies, xml ) | Need Help?? |
|
size is a terrible name, because it doesn't imply any unit. It could stand for string length in characters, string length in bytes, used memory, number of allocated elements in a container, number of actual elements in a container or any other size you can think of. It makes sense to you now because it's not too bad in the mental context you are in, but from the outside it's not good. Anyway, if you don't fiddle with prototypes at all, the argument list of a subroutine is automatically in list context, so you can just write
and don't need a new keyword at all.
In Section
Meditations
|
|
||||||||||||||||||||||||||||