in reply to Values passed into a sub routine
If I follow, the syntaxcalling convention is
build_url($account, [ $transaction, [ $location, ] ] $fname, $lname);
where square brackets denote optional parameters. You could use
orsub build_url { my $lname = pop; my $fname = pop; my ($account, $transaction, $location) = @_; ... }
orsub build_url { my $account = shift; my $transaction = @_>=4 ? shift : undef; my $locaton = @_>=3 ? shift : undef; my $fname = shift; my $lname = shift; ... }
sub build_url { splice(@_, 1, 0, (undef)x(5-@_)) my ($account ,$transaction, $location, $fname, $lname) = @_; ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Values passed into a sub routine
by Anonymous Monk on Apr 19, 2011 at 17:18 UTC | |
by ikegami (Patriarch) on Apr 19, 2011 at 17:25 UTC | |
by Anonymous Monk on Apr 19, 2011 at 18:11 UTC |