Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: findone { coderef } @array

by jynx (Priest)
on Feb 26, 2002 at 18:16 UTC ( [id://147674]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: findone { coderef } @array
in thread findone { coderef } @array


For the wantarray, i see the usefulness, but i was commenting on moving the return outside of the ?:. It's not really a big deal, but it would look something like:
return wantarray ? ($_,'blah') : $_;
For the end hook, you have a start index, you can receive an extra scalar as the end index, and only pick it up if they've put in a start index as well. Prototype would be kinda like:

findone { code } @list
findone { code } @list, $start_index
findone { code } @list, $start_index, $end_index

So if they know they don't need to walk further than a certain place on the array they can be certain to stop there.

jynx

Replies are listed 'Best First'.
Re: Re^3: findone { coderef } @array
by shotgunefx (Parson) on Feb 26, 2002 at 19:33 UTC
    Good point. I added the end_index.

    -Lee

    "To be civilized is to deny one's nature."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://147674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2025-06-16 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.