Thanks! This is what I'm looking for.
 
-------------- Original message --------------
From: "DePriest, Jason R." <[EMAIL PROTECTED]>

> use Math::BigFloat;
> $m = Math::BigFloat->new('7191750529163469.123'); # notice NO double
> quotes, this is still a number
> print "$m\n";
> $m =~ /(\d\d\d)$/; #Get the last three digits.
> print "$1\n";
>
> This gives:
> 7191750529163469.123
> 123
>
> which is what you are looking for I think.
>
> -Jason
>
> On 1/9/06, [EMAIL PROTECTED] <> wrote:
> >
> > I am trying to do some simple regular expressions but just can't get them
> > right.
> >
> > I have a very long number that I am trying to perform some reg ex funtions
> > on. When I put the long number in quotes, the reg ex works fine. When I do > > ot use quotes, the number is viewed as numeric and the reg ex pulls out the
> > scientific notation.
> >
> > These are numbers and not strings. How do I use the reg ex and get the
> > proper numeric information? I am familiar with Math::BigFloat but have not
> > found a solution to my problem within that module.
> >
> > It seems like a simpler question would be; how do I tell Perl to not convert
> > my long numbers to scientific notation?
> >
> > BTW I am using Active State v5.8.7 on Windows XP.
> >
> > Following are code/output samples.
> >
> > Example 1:
> > ## Grab the last three digits after decimal\n";
> > $m = "7191750529163469.123"; # notice the double quotes, this is now a
> > string
> > print "$m\n";
> > $m =~ /(\d\d\d)$/; #Get the last three digits.
> > p! rint "$1\n";
> >
> > Output:
> > 7191750 529163469.123
> > 123 (this is what I wanted the reg ex to pull out)
> >
> > Example 2:
> > ## Grab the last three digits after decimal\n";
> > $m = 7191750529163469.123; # notice NO double quotes, this is still a
> > number
> > print "$m\n";
> > $m =~ /(\d\d\d)$/; #Get the last three digits.
> > print "$1\n";
> >
> > Output:
> > 7.19175052916347e+015
> > 015 (this is NOT what I wanted the reg ex to pull out)
> > _______________________________________________
> > ActivePerl mailing list
> > ActivePerl@listserv.ActiveState.com
> > To unsubscribe:
> > http://listserv.ActiveState.com/mailman/mysubs
> >
> >
>
> _______________________________________________
> ActivePerl mailing list
> ActivePerl@listserv.ActiveState.com
> To unsubscribe: http://l! istserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to