Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,12 @@
|
|||
my %scale =
|
||||
Celcius => { factor => 1 , offset => -273.15 },
|
||||
Rankine => { factor => 1.8, offset => 0 },
|
||||
Fahrenheit => { factor => 1.8, offset => -459.67 },
|
||||
;
|
||||
|
||||
my $kelvin = +prompt "Enter a temperature in Kelvin: ";
|
||||
die "No such temperature!" if $kelvin < 0;
|
||||
|
||||
for %scale.sort {
|
||||
printf "%12s: %7.2f\n", .key, $kelvin * .value<factor> + .value<offset>;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
while my $answer = prompt 'Temperature: ' {
|
||||
my $k = do given $answer {
|
||||
when s/:i C $// { $_ + 273.15 }
|
||||
when s/:i F $// { ($_ + 459.67) / 1.8 }
|
||||
when s/:i R $// { $_ / 1.8 }
|
||||
when s/:i K $// { $_ }
|
||||
default { $_ }
|
||||
}
|
||||
say " { $k }K";
|
||||
say " { $k - 273.15 }℃";
|
||||
say " { $k * 1.8 - 459.67 }℉";
|
||||
say " { $k * 1.8 }R";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue