If I understand correctly, you want to pass $r[0] back from sub interface_control to its caller? One way is to pass in a variable reference:
my $r; my $s = ...; interface_control($s, \$r); # use $r here ... sub interface_control { my ($s, $r_ref) = @_; my (@r, $v, @h); $s->get_handles(rtrs=>\@r, vars=>\$v, hosts=>\@h); $$r_ref = $r[0]; # dereference $r_ref and write to its referent ...
See perlreftut. (Or, of course, you could just return $r[0] at the end of the subroutine.)
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Accessing single element without args
by Athanasius
in thread Accesing single element without args
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |