(That's the "quickest" thing, though some rearrangement -- possibly using a loop over a data structure of call parameters -- would be worthwhile.)if ( $page eq 'x1a.html' ) { $re_type = "a2"; $Q = ($prod) ? 'a0' : 'a0'; $send=$sec.$account.$year.$view; got_send(); # first "page" $re_type = "x2"; $Q = ($prod) ? 'p0' : 'w0'; $send=$sec.$account.$year.$view; got_send(); # second "page" $req_type = "y1"; $Q = ($prod) ? 'p0' : 'w0'; $send=$sec.$account.$year.$view.$action; got_send(); # third "page" }
But I suppose there might be something you haven't shown us in your "got_send()" sub that makes this impractical?
The way out would be to refactor the "got_send" sub to make it more modular: pass parameters to it on each call, instead of having it refer to global variables; have it return a string (or something), which the caller will know what to do with, based on the caller's knowledge of the context for each call, rather than trying to do everything inside of "got_send()".
Perhaps I'm misunderstanding the question? Or maybe you've left out some useful details...
In reply to Re: Combining calls to a subroutine issue.
by graff
in thread Combining calls to a subroutine issue.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |