in reply to setting values inside subroutine

You say users can't modify this sub, but I take it you can, so you could pass an optional index value to your sub:
sample($t,0); sub sample { my $t = shift; my $index = shift; my ($p, @r, $v, $rt); $t->get_handles(params=>\$p, rtrs=>\@r, vars=>\$v, t=>\$rt); my @subs; if (defined $index) { my $rh = $r[$index]; <some command at execution> } else { foreach my $rh (@r) { <some command at execution> ... } } }

Replies are listed 'Best First'.
Re^2: setting values inside subroutine
by Anonymous Monk on Sep 16, 2015 at 12:29 UTC

    Thanks.But, i don't have control over sub SAMPLE. I CAN'T touch it. The problem is, there are around 100 sub's like SAMPLE, which do not have the flexibility as per my ask