P is for Practical | |
PerlMonks |
Re: Function Prototypes and Array vs. List (Pt. 2)by Abigail-II (Bishop) |
on Jun 13, 2002 at 16:01 UTC ( [id://174252]=note: print w/replies, xml ) | Need Help?? |
I'd say the specification of create is incomplete.
Prototyping does act surprisingly because it goes against
the list flattening you'd expect from unprototyped functions.
Not specifying that a function is prototyped, or not saying
that the first argument will be evaluated in scalar context
means, IMO, that the description is incomplete (and hence wrong).
I only use prototypes if there are clear benefits (\@ and & prototypes, sometimes a prototype with a single $ (which changes the way perl compiles your Perl)). But often it's too much of a nuisance. I also don't agree with your reasoning that with such a simple description of create you should use $array[0] Take a look at the description of POSIX::strftime. With your reasoning, the proper way of calling it would be: instead of
strftime could have been prototyped as $$$$$$$;$$$; the description doesn't say it's not, and spells out the arguments for strftime. Abigail
In Section
Seekers of Perl Wisdom
|
|