in reply to Accesing single element without args
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, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Accessing single element without args
by Anonymous Monk on Mar 31, 2015 at 03:38 UTC | |
by Athanasius (Archbishop) on Mar 31, 2015 at 04:02 UTC | |
by Anonymous Monk on Mar 31, 2015 at 04:18 UTC | |
by Athanasius (Archbishop) on Mar 31, 2015 at 06:09 UTC | |
by Anonymous Monk on Mar 31, 2015 at 06:39 UTC | |
by Anonymous Monk on Mar 31, 2015 at 03:49 UTC |