develooper Front page | perl.beginners | Postings from May 2010

Re: about dispatch tables

Thread Previous | Thread Next
From:
Akhthar Parvez K
Date:
May 6, 2010 01:22
Subject:
Re: about dispatch tables
Message ID:
201005061352.03606.akhthar@sysadminguide.com
On Wednesday 05 May 2010, Harry Putnam wrote:
> But even though I can work with that... I'm still not seeing why the
> values in @_ are not available at the call to N() inside like this: 
> (incomplete code)
> 
> func($val1,$val2);
> 
> sub func { %h = ( N => sub { print N(@_#HERE) . "\n"; } ); }

If you're trying to use the arguments passed to the subroutine 'func' in the code reference of $h{N}, It can't be done. The code reference here is another subroutine under the subroutine func and the arguments list of a subroutine is not the argument list of another subroutine inside that.

>>print N(@_#HERE)
Why are you calling the subroutine N? Have you already defined a subroutine with the name N in your program? 

-- 
Regards,
Akhthar Parvez K
http://Tips.SysAdminGUIDE.COM
UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity - Dennie Richie

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About