[Edinburgh-pm] Parameter passing, seeking an answer....

Ben Soares ben.soares at ed.ac.uk
Thu Sep 6 01:53:07 PDT 2007


When using a "named" parameters method I like to do

sub myFunc {
	my ($self, %params) = @_;
	if ($params{"-filename"}) {
		&etc();
	}
}

Ben

PS You could have asked me over the partition ;)


On Thu, 2007-09-06 at 08:49 +0100, Ian Stuart wrote:
> When I first started coding, I'd pick up parameters in functions thus:
> 
> sub myFunc {
>   my self = shift;
>   # stuff
> }
> 
> I've noticed that people have moved to a new style:
> 
> sub myFunc {
>    my ($self) = @_;
>    # stuff
> }
> 
> Is there a good compelling reason for this (new to me) style?
> 



More information about the Edinburgh-pm mailing list