Acme-Tools
view release on metacpan or search on metacpan
litres => 0.001,
gal => 231 * 0.0254**3, #3.785411784 L = 0.003785411784 m3, #231 cubic inches
gallon => 231 * 0.0254**3,
gallons => 231 * 0.0254**3,
gallon_us => 231 * 0.0254**3, #231 cubic inches
gallon_wine => 231 * 0.0254**3, #queen anne's gallon
gallon_ale => 282 * 0.0254**3, #beer
gallon_corn => 268.8*0.0254**3, #corn, or winchester gallon
gallon_uk => 4.54609/1000, #constant 4.54609 from definition
gallon_imp => 4.54609/1000, #imperial
gallon_us_dry => 4.40488377086/1000, # ~ 9.25**2*pi*2.54**3/1000 L
#hogshead, gill, pail, jigger, jackpot, The Science of Measurement - A Historical Survey (Klein)
cm3 => 0.01**3, #0.001 L
in3 => 0.0254**3, #0.016387064 L
ft3 => (0.0254*12)**3,
tablespoon=> 3.785411784/256, #14.78676478125 mL
tsp => 3.785411784/256/3, #4.92892159375 mL
teaspoon => 3.785411784/256/3, #4.92892159375 mL
floz => 3.785411784/128, #fluid ounce US
floz_uk => 4.54609/160, #fluid ounce UK
pint => 4.54609/8000, #0.56826125 L
$pop =~ s/,//g;
printf "%3d | %-32s | %9d\n", @$_ if $pop>0;
}
Output:
1 | China | 1367740000
2 | India | 1262090000
3 | United States | 319043000
4 | Indonesia | 252164800
5 | Brazil | 203404000
...and so on.
=cut
sub ht2t {
my($f,$s,$r)=@_; 1>@_||@_>3 and croak; $s='' if @_==1;
$f=~s,.*?($s).*?(<table.*?)</table.*,$2,si;
my $e=0;$e++ while index($f,$s=chr($e))>=$[;
$f=~s/<t(d|r|h).*?>/\l$1$s/gsi;
t/06_conv.t view on Meta::CPAN
check( 8000, 'NOK', 'IDR', sub{ 8000 / $m{IDR} } );
check( 1, 'BTC', 'NOK', sub{ 1 * $m{BTC} } );
check( '10', 'hex', 'des', 16 );
check( '101010', 'bin', 'des', 42 );
check( '29', 'hex', 'bin', 101001 );
check( 'DCCXLII', 'roman', 'oct', 1346);
check( 4, 'rood', 'acres', 1 );
check( 1, 'ac', 'ft2', 43560 );
check( 1, 'acres','m2', 4046.8564224 );
ok( conv( 101010, 'bin', 'roman') eq 'XLII', 'b101010 => roman XLII');
t/test_pi.pl view on Meta::CPAN
298336733624406566430860213949463952247371907021798609437027705392171762
931767523846748184676694051320005681271452635608277857713427577896091736
371787214684409012249534301465495853710507922796892589235420199561121290
219608640344181598136297747713099605187072113499999983729780499510597317
328160963185950244594553469083026425223082533446850352619311881710100031
378387528865875332083814206171776691473035982534904287554687311595628638
823537875937519577818577805321712268066130019278766111959092164201989380
952572010654858632788659361533818279682303019520353018529689957736225994
138912497217752834791315155748572424541506959508295331168617278558890750
983817546374649393192550604009277016711390098488240128583616035637076601
047101819429555961989467678374494482553797747268471040475346462080466842
590694912933136770289891521047521620569660240580381501935112533824300355
876402474964732639141992726042699227967823547816360093417216412199245863
150302861829745557067498385054945885869269956909272107975093029553211653
449872027559602364806654991198818347977535663698074265425278625518184175
746728909777727938000816470600161452491921732172147723501414419735685481
pi_bin();
sub pi_1 { # pi = 4 sigma(0..inf) -1^k/(2k+1)
( run in 0.659 second using v1.01-cache-2.11-cpan-39bf76dae61 )