Re: better one liner for variable's value assignment

2004-03-20 Thread John W. Krahn
"John W. Krahn" wrote: > > "Jupiterhost.Net" wrote: > > > > John W. Krahn wrote: > > > > > > This will work if param('xid') returns anything but undef: > > > > > > my ( $xid ) = param( 'xid' ) =~ /(^\d+$|)/; > > > > I like that, good idea. It is possible it may be undef though, doh! > > If it is

Re: better one liner for variable's value assignment

2004-03-20 Thread John W. Krahn
"Jupiterhost.Net" wrote: > > John W. Krahn wrote: > > > > This will work if param('xid') returns anything but undef: > > > > my ( $xid ) = param( 'xid' ) =~ /(^\d+$|)/; > > I like that, good idea. It is possible it may be undef though, doh! If it is and you have warnings enabled (you DO have war

Re: better one liner for variable's value assignment

2004-03-20 Thread JupiterHost.Net
John W. Krahn wrote: "Jupiterhost.Net" wrote: Howdy, Hello, I'm looking to have a one liner version of this: my $xid = ''; $xid = param('xid') if param('xid') =~ m/^\d+$/; Basically, if the param is numeric then assign it to $xid, other wise '' (IE empty but declared) Some thing like: my $xi

Re: better one liner for variable's value assignment

2004-03-20 Thread John W. Krahn
"Jupiterhost.Net" wrote: > > Howdy, Hello, > I'm looking to have a one liner version of this: > > my $xid = ''; > $xid = param('xid') if param('xid') =~ m/^\d+$/; > > Basically, if the param is numeric then assign it to $xid, other wise '' > (IE empty but declared) Some thing like: > > my $xi

Re: better one liner for variable's value assignment

2004-03-20 Thread JupiterHost.Net
Paul Johnson wrote: On Sat, Mar 20, 2004 at 03:10:18PM -0600, JupiterHost.Net wrote: Howdy, I'm looking to have a one liner version of this: my $xid = ''; $xid = param('xid') if param('xid') =~ m/^\d+$/; Basically, if the param is numeric then assign it to $xid, other wise '' (IE empty but d

Re: better one liner for variable's value assignment

2004-03-20 Thread JupiterHost.Net
James Edward Gray II wrote: On Mar 20, 2004, at 3:10 PM, JupiterHost.Net wrote: Howdy, I'm looking to have a one liner version of this: Why? Do you win a cookie if you do it in one line? ;) Not so much a cookie as some sugar :) I win cookies at work for writing clear code, which often inv

Re: better one liner for variable's value assignment

2004-03-20 Thread Paul Johnson
On Sat, Mar 20, 2004 at 03:10:18PM -0600, JupiterHost.Net wrote: > Howdy, > > I'm looking to have a one liner version of this: > > my $xid = ''; > $xid = param('xid') if param('xid') =~ m/^\d+$/; > > Basically, if the param is numeric then assign it to $xid, other wise '' > (IE empty but declar

Re: better one liner for variable's value assignment

2004-03-20 Thread James Edward Gray II
On Mar 20, 2004, at 3:10 PM, JupiterHost.Net wrote: Howdy, I'm looking to have a one liner version of this: Why? Do you win a cookie if you do it in one line? ;) I win cookies at work for writing clear code, which often involves more than one line. my $xid = ''; $xid = param('xid') if param(