SPUG: number inside of a number

Dave O cxreg at pobox.com
Tue Sep 19 17:13:51 PDT 2006


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/
>
>
>


More information about the spug-list mailing list