> > $m = $_[1] unless(!$_[1]);
> 
> This is scary itself, a double negative unless is a bit 
> confusing.  "if" would have been better I think.
Good point

> 
> > I want to do a one liner
> 
> my $m = $_[1] || 'text/plain';

Oh!! I never thought of using || for an assignment. Sweet idea.
Thanks

Dan

> 
> You can have as many conditions as you want, the first that 
> is "true" (not blank, zero or undef) will be used.
> 
> Rob
> 
> 
> -----Original Message-----
> From: Dan Muey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 05, 2003 11:33 AM
> To: [EMAIL PROTECTED]
> Subject: single line condition statement with semicolon
> 
> 
> Hello 
> 
> 
> What I want to do is assign the value of $_[1] to $m unless 
> it's empty then assign it 'text/plain' This currently works 
> but I want to do a one liner I think you can do that with a 
> colon but I can't seem to find the syntax
> 
> $m = 'text/plain';
> $m = $_[1] unless(!$_[1]);
> 
> Somehting like
> 
> $m = $_[1] unless(!$_[1]) :$m = 'text/plain';
> 
> But I can get it right, any assistance would be much appreciated.
> 
> Thanks
> 
> Dan
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to