SPUG: number inside of a number

DeRykus, Charles E charles.e.derykus at boeing.com
Tue Sep 19 18:28:00 PDT 2006


Perhaps $number won't always be an integer though...

-- 
Charles DeRykus

-----Original Message-----
From: Dave O [mailto:cxreg at pobox.com] 
Sent: Tuesday, September 19, 2006 5:14 PM
To: Kevin Fink
Cc: luis medrano; spug-list at pm.org
Subject: Re: SPUG: number inside of a number

Or, avoid the number-to-string-to-number conversion:

if($number % 10 == 5)

On Tue, 19 Sep 2006, Kevin Fink wrote:

> if(substr($number,-1,1) == 5)
>
>
> luis medrano wrote:
> > List,
> >
> > I have a question, I need a variable where is holding a value 
> > (number) but I need to check and verify the last digit. For example
:
> > My $number=98765;
> >
> > if ($number  last digit is 5)
> >
> > I really appreciate you help.
> >
> > Thanks,
> > Luis
> >
> >
> > --------------------------------------------------------------------
> > ----
> >
> > _____________________________________________________________
> > Seattle Perl Users Group Mailing List
> >      POST TO: spug-list at pm.org
> > SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
> >     MEETINGS: 3rd Tuesdays
> >     WEB PAGE: http://seattleperl.org/
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
>      POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
>     MEETINGS: 3rd Tuesdays
>     WEB PAGE: http://seattleperl.org/
>
>
>
_____________________________________________________________
Seattle Perl Users Group Mailing List  
     POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
    MEETINGS: 3rd Tuesdays
    WEB PAGE: http://seattleperl.org/


More information about the spug-list mailing list