Re: single line condition statement with semicolon

2003-03-05 Thread Rob Dixon
Dan Muey wrote: > > $m = $_[1] ? $_[1] : 'text/plain'; > Excellent!! I also received the suggestion > my $m = $_[1] || 'text/plain'; > > Any body have any pros/cons about which would be more > efficient/better ?? I second Rob H's version - the second one - as being more Perlish. It also avoids re

RE: single line condition statement with semicolon

2003-03-05 Thread Dan Muey
t; 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

RE: single line condition statement with semicolon

2003-03-05 Thread Dan Muey
> > $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 > > > > $m = $_[1] ? $_[1] : 'text/plain'; Excellent!! I a

RE: single line condition statement with semicolon

2003-03-05 Thread Beau E. Cox
Hi - > -Original Message- > From: Dan Muey [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 05, 2003 6:33 AM > To: [EMAIL PROTECTED] > Subject: single line condition statement with semicolon > > > Hello > > > What I want to do is assign the value of

Re: single line condition statement with semicolon

2003-03-05 Thread Lance
I think something like: if( $_[1] ) ? $m = $_[1] : $m ='text/plain'; might work. Try looking up the perl 'trinary' operator. "Dan Muey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] com... Hello What I want to do is assign the value of $_[1] to $m unless it's empty then assign

RE: single line condition statement with semicolon

2003-03-05 Thread Hanson, Rob
uot; (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

single line condition statement with semicolon

2003-03-05 Thread Dan Muey
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