Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: new keyword "size" to avoid scalar trap ? ( scalar @array != scalar(LIST) )

by LanX (Chancellor)
on Dec 07, 2012 at 17:22 UTC ( #1007801=note: print w/replies, xml ) Need Help??

in reply to Re: new keyword "size" to avoid scalar trap ? ( scalar @array != scalar(LIST) )
in thread new keyword "size" to avoid scalar trap ? ( scalar @array != scalar(LIST) )

> I don't see a need for it.

Honestly, did you immediately spot the problem in BUK's code?

Re: Idiom to return 0 or random number of array elements


Do you really prefer explaining goatse "op"  =()= and turtle "op" @{[ ]} to newbes who simply need to count the elements a function returns?


> I'd rather see them overload length to accept a hash, array or reference to a hash or array.

Then it's quite impossible to tell what length ($str) is supposed to return. 1 for the list-size or the char-size of $str?

Cheers Rolf

Replies are listed 'Best First'.
Re^3: new keyword "size" to avoid scalar trap ? ( scalar @array != scalar(LIST) )
by roboticus (Chancellor) on Dec 07, 2012 at 20:11 UTC


    No, I didn't notice the error. And I've never used goatse, turtle or kite. Perhaps if I had, I'd see the need for it.

    As far as the practicality of what length $str is supposed to return, I didn't give it much thought. I was just expressing my color preference for new new shed out back. ;^)


    When your only tool is a hammer, all problems look like your thumb.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1007801]
[Your Mother]: "Tick Twister."
[1nickt]: My sister lives in the Sydney suburbs (carved out of the bush) and they have the Paralysis tick -- leavs you quadriplegic!
[perldigious]: Hmm, thanks Lotus1... perldigious scribbles note to buy lots of opossums as "pets" in the future to hang around outside his property. :-P
[1nickt]: You must twist and pull! If you burn, use tea tree oil etc, the tick barfs (inside your blood vessel) and you get all the loevely bacteria in his gut transferred to yours.
[1nickt]: tweesers work just fine
[hippo]: Hope everyone else is enjoying their lunch too.
[1nickt]: However, note that it takes between 2 and 4 hours for a tick to be able to start transmitting bacteria. So even if it has burrowed in and started eating, if you get it soon you should be OK.
[perldigious]: 1nickt: No more red meat! It would be more humane to just kill you, wouldn't it! :-)
[1nickt]: Just don't make it barf.
[1nickt]: perldigious that's exactly what my stepson says.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (14)
As of 2017-05-24 13:08 GMT
Find Nodes?
    Voting Booth?