Re: ref's to subs

2003-11-04 Thread Jeff 'japhy' Pinyan
On Nov 5, Tore Aursand said: >On Tue, 04 Nov 2003 13:58:41 -0500, mgoland wrote: >> %hash=( 1 => funca(), >> 2 => funcb(), >> ); > >Try this: > > %hash = (1 => \&funca(), > 2 => \&funcb()); No; \&foo is a reference to the foo function, but \&foo() is a reference to the re

Re: ref's to subs

2003-11-04 Thread Tore Aursand
On Tue, 04 Nov 2003 13:58:41 -0500, mgoland wrote: > %hash=( 1 => funca(), > 2 => funcb(), > ); Try this: %hash = (1 => \&funca(), 2 => \&funcb()); -- Tore Aursand <[EMAIL PROTECTED]> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [E

RE: ref's to subs

2003-11-04 Thread Tim Johnson
Why do the subs execute? Because you told them to. When you type funca(), you're telling Perl to execute funca, but don't pass it any parameters. You don't "declare" subs in Perl the way you would in C. The only place you declare a sub is in the "sub mySub{BLOCK}" statement. You CAN prototype a

Re: ref's to subs

2003-11-04 Thread Rob Dixon
Mark wrote: > > I am trying to create a hash where each key is a referance to > subs. The bellow code produces the expected result, with one > unexpected side-effect. Why are the subs executed when I only > declare them ?? > > <- cut > #!/usr/local/bin/perl -w > > > %hash=( 1 => funca(), >

Re: ref's to subs

2003-11-04 Thread James Edward Gray II
On Tuesday, November 4, 2003, at 12:58 PM, [EMAIL PROTECTED] wrote: Hello Perler's I am trying to create a hash where each key is a referance to subs. The bellow code produces the expected result, with one unexpected side-effect. Why are the subs executed when I only declare them ?? <- cut #!