On Wed, Aug 5, 2009 at 05:21, Dermot<paik...@googlemail.com> wrote:
> 2009/8/5 Chas. Owens <chas.ow...@gmail.com>:
>> On Tue, Aug 4, 2009 at 23:07, Dave Tang<d.t...@imb.uq.edu.au> wrote:
>>> On Wed, 05 Aug 2009 12:55:22 +1000, Chas. Owens <chas.ow...@gmail.com>
>>> wrote:
>>>
>>> snip
>
> Here's someone's recent experience of encountering prototypes:
>
> http://perlhacks.com/2009/06/what-is-wrong-with-this-picture.php
>
> Good luck,
> Dp.
>

Yes, calling a function with & at the beginning will bypass a
prototype.  So will calling it via a reference (which means prototypes
mean nothing the OO Perl):

#!/usr/bin/perl

use strict;
use warnings;

#one $ means this is a unary function (i.e. it takes one scalar)
sub foo ($) {
    print join("::", @_), "\n";
}

eval "foo(1, 2); 1"; #this will fail because we are passing in two arguments
print $@;
my $coderef = \&foo;
$coderef->(1, 2, 3); #but this succeeds no problem

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to