CColin has asked for the wisdom of the Perl Monks concerning the following question:
Hi
Am trying to parse some HTML in TreeBuilder which returns fractional values '1/2', '1/4', '3/4' and would like to
represent these as decimals.
I hoped I could go into HTML::Entities and find out how to simply spot the mapping of the HTML values to fractions and change it to decimals.
I can see in the source that HTML is converted to the following "frac" values (and vice versa):
But I can't see how the "frac" values are converted to display fractions, or how I can convert these fractions to decimals instead. Ideally I want frac14, frac12 and frac34 to convert to values tofrac14 => chr(188), frac12 => chr(189), frac34 => chr(190),
respectively. I suppose I could ignore the modules and go and try to change all the HTML by regexes, but that kind of misses the point and makes everything else harder to maintain. Thanks for any guidance..25, .5, .75
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: frac12 to decimal
by karoshi (Novice) on Feb 09, 2009 at 03:52 UTC | |
by CColin (Scribe) on Feb 09, 2009 at 18:19 UTC | |
by karoshi (Novice) on Feb 10, 2009 at 00:06 UTC | |
by Anonymous Monk on Feb 10, 2009 at 00:45 UTC | |
Re: frac12 to decimal
by kennethk (Abbot) on Feb 09, 2009 at 03:47 UTC |
Back to
Seekers of Perl Wisdom