"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 and you have warnings enabled (you DO have warnings enabled
> don't you?) then you will get the warning:
>
> Use of uninitialized value in pattern match (m//)
>
> But you would get that no matter which solution you used.
There is a little "trick" you can use to ensure that that works even
with an undef value:
my ( $xid ) = ~~param( 'xid' ) =~ /(^\d+$|)/;
:-)
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>