in reply to Re: Dynamic Code?
in thread Dynamic Code?

Dang, too little coffee today :)
That was actually just a reference to an anonymous sub I just described, not a real closure..

$a = sub { if($joe){somesub($arg1,$arg2);} }

would do just the same..
//mikkoH

Replies are listed 'Best First'.
RE: RE: Re: Dynamic Code?
by Adam (Vicar) on Aug 25, 2000 at 21:41 UTC
    Ah, but it could be <grin>, its just a question of when you want $arg1 and $arg2 defined... maybe kael wanted the args declared when $a is declared....
    sub func{ die 'func takes 2 args' unless 2 == @_; my ( $arg1, $arg2 ) = @_; return sub { somesub($arg1,$arg2) if($joe) } } $a=&func( $somearg, $someotherarg ); # do stuff.. # call the function &$a;