Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Are prototypes evil?

by BrowserUk (Pope)
on Sep 02, 2002 at 21:40 UTC ( #194640=note: print w/ replies, xml ) Need Help??

in reply to Are prototypes evil?

I guess the best answer is the very last part of the "Prototypes" section of perlman:perlsub which concludes with:

And the split gets called in scalar context so it starts scribbling on your @_ parameter list. Ouch!

Effectively, using prototypes throws away one of the nicest and most unique features of perl, namely the context sensitivity of the calling eviroment. Using them renders wantarray superfluous.

Well It's better than the Abottoire, but Yorkshire!

Comment on Re: Are prototypes evil?
Download Code
Replies are listed 'Best First'.
Re: Re: Are prototypes evil?
by Django (Pilgrim) on Sep 02, 2002 at 21:53 UTC

    I think you're mixing up two things:
    A ($) prototype would force scalar input to a sub, but that doesn't have any influence on the return context.
    Look at this:

    sub Input ($) { wantarray ? split /,/ : $_; } my @List = Input $Source;

    "Why don't we ever challenge the spherical earth theory?"

      Your right! I was talking twaddle!

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2015-07-29 01:13 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (260 votes), past polls