From e270d6de7adc6549da446ce2145adf295efa7846 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sun, 29 Mar 2020 20:36:02 +0200 Subject: [PATCH] fixed converters --- rpnc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rpnc b/rpnc index c7468ec..059f5fe 100755 --- a/rpnc +++ b/rpnc @@ -3,6 +3,7 @@ use Term::ReadLine; use Data::Dumper; use Getopt::Long; +use Data::Dumper; use strict; use warnings; @@ -174,18 +175,18 @@ my %func = ( }, # converters: # gallons to liters - 'tl' => sub { return $_[0] * 3.785 }, + 'tl' => sub { return $_[-1] * 3.785 }, # yards to meters - 'tm' => sub { return $_[0] * 91.44 }, + 'tm' => sub { return $_[-1] * 91.44 }, # miles to kilometers - 'tk' => sub { return $_[0] * 1.609 }, + 'tk' => sub { return $_[-1] * 1.609 }, # inches to cm - 'tc' => sub { return $_[0] * 2.54 }, + 'tc' => sub { return $_[-1] * 2.54 }, # to 'bytes - 'tkb' => sub { return $_[0] / 1000 }, - 'tmb' => sub { return $_[0] / 1000 / 1000}, - 'tgb' => sub { return $_[0] / 1000 / 1000 / 1000 }, - 'ttb' => sub { return $_[0] / 1000 / 1000 / 1000 / 1000 }, + 'tkb' => sub { return $_[-1] / 1000 }, + 'tmb' => sub { return $_[-1] / 1000 / 1000}, + 'tgb' => sub { return $_[-1] / 1000 / 1000 / 1000 }, + 'ttb' => sub { return $_[-1] / 1000 / 1000 / 1000 / 1000 }, ); # math constants, always upper case letters, usable via eval{}