Elliot Tobin wrote at Thu, 05 Sep 2002 20:35:48 +0200:

> If my constructor takes four arguments, ala:
> 
> my ($instanceName, $instanceHost, $instanceUser, $instancePass) = @_;
> 
> What's an eloquent way of looping through those four and setting their 
> value to "" if there are no arguments passed?  

Another way could be:

my ($name, $host, $user, $pass) = map {shift() || ""} (1 .. 4);

(allthough, you get problems if anybody passes an 0 or similar)


Greetings,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to