Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: sub argument passing? (TIMTOWTDI)

by AnomalousMonk (Abbot)
on Sep 17, 2012 at 21:04 UTC ( #994103=note: print w/ replies, xml ) Need Help??


in reply to Re: sub argument passing? (TIMTOWTDI)
in thread sub argument passing? (TIMTOWTDI)

#prototyped to explicitly state acceptable arguments sub addstuff($$$); ... #gives error if too few or too many arguments #(or arguements of wrong type)

OTOH:

>perl -wMstrict -le "my @ra = (99 .. 199); ;; sub S ($$$) { my $A = shift; my $B = shift; my $C = shift; ;; return $A + $B + $C; } ;; print S 1, 2, @ra; " 104

Maybe better read Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen first, then generally avoid prototypes.


Comment on Re^2: sub argument passing? (TIMTOWTDI)
Select or Download Code
Re^3: sub argument passing? (TIMTOWTDI)
by temporal (Pilgrim) on Sep 17, 2012 at 21:45 UTC

    Thanks AnomalousMonk, I am following your advice and already seeing some issues that I'll run into with using Perl's prototyping such as it is.

    'Enjoyable light reading' indeed, protist! Maybe just enjoyable ;)

    Strange things are afoot at the Circle-K.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2015-07-06 07:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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









    Results (70 votes), past polls