thanks

but i think that i found out my problem really is that i try
to concatenate a function name:
your code works but this doesn't:

my $sub_routine = "function";
$out = eval($sub_routine . "_name('$selected', $flag, \\%lookup_menu)");

i want the same effect as if it were:

$out = function_name($selected, $flag, \%lookup_menu);


../allan


Martin Moss wrote:
> 
> how about?
> 
> my $string;
> eval
> {
>         $string=&mysub(\%myhash);
> }
> 
> > -----Original Message-----
> > From: allan [mailto:[EMAIL PROTECTED]]
> > Sent: Monday 11 March 2002 09:57
> > To: macperl-anyperl
> > Subject: [MacPerl-AnyPerl] passing reference in eval
> >
> >
> > hi
> >
> > i need to (i think) pass a hash as a reference to a sub
> > routine for ultimately letting that sub return a string.
> > that sub is placed in another file which i require beforehand.
> > i know the hash is ok
> > i know i can pass an require plain scalars
> > but is it possible to pass a hash or any reference in the
> > middle of an eval?
> >
> >
> > the closest i have come to succes is something not fully
> > working as below:
> >
> > my %lookup_menu = (
> >     1 => HOME,
> >     2 => PARTNERS,
> > );
> >
> >
> > require 'relevant_file';
> > $out = eval($sub_routine . "(\\%lookup_menu)");
> > print $out;
> >
> >
> > ../allan

Reply via email to