in reply to Re^4: Preferred technique for named subroutine parameters?
in thread Preferred technique for named subroutine parameters?
Seems like more typing for a worse result to me. Oh, and if you rename your function, you have to synchronize the function with the error message. A little laziness on that part could lead to all sorts of puzzlement.use strict; Foo::bar(); package Foo; use Carp qw(croak); sub bar { baz(one => 'uno', two => 'dos', three => ); } sub baz { croak "wrong number of arguments for baz(); has to be even" if sca +lar(@_) % 2; my %args = @_; print "func: one translates to $args{one} \n"; } __END__ wrong number of arguments for baz(); has to be even at - line 2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Preferred technique for named subroutine parameters?
by shmem (Chancellor) on May 23, 2009 at 10:22 UTC | |
|
Re^6: Preferred technique for named subroutine parameters?
by Porculus (Hermit) on May 23, 2009 at 23:07 UTC | |
by bluto (Curate) on May 26, 2009 at 16:42 UTC |