proto-type sub needs new ribbon ?

S

stu7

+
With Perl 5.6, I'm trying to use prototypes and a new
subroutine...

sub testproto($) { subroutine here }

With this, I tried to use the actual "prototype" call...

prototype testproto ;
and I also tried
print prototype testproto;

however, the subroutine output seems unaffected regardless of
what parameters are sent... $a or @Arr... and the prototype command
doesnt seem to return anything at all.

Am I using these correctly, or isnt prototyping of this kind
working in Perl yet ?
 
B

Brian Harnish

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

+
With Perl 5.6, I'm trying to use prototypes and a new
subroutine...

sub testproto($) { subroutine here }

With this, I tried to use the actual "prototype" call...

prototype testproto ;
and I also tried
print prototype testproto;

however, the subroutine output seems unaffected regardless of
what parameters are sent... $a or @Arr... and the prototype command
doesnt seem to return anything at all.

Am I using these correctly, or isnt prototyping of this kind
working in Perl yet ?

Try posting some real code so the rest of us can see your exact problem!

#!perl -wl
use strict;
sub mypush(\@@) {return @_}
print "Version: $]";
print prototype \&mypush;
my@x=(1..5);
print mypush(@x,3,4,5)
__END__

I get this:
Version: 5.006001
\@@
ARRAY(0x8100010)345

Seems to work fine to me.

- Brian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/RXUciK/rA3tCpFYRAhP1AJ9HpbLEXaOIJmaWaz+FKCUs47jQmACfbKaK
2ZZcPMmAwOnYtBhwr+6LATM=
=NAqT
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top