3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-03 09:58:42 +02:00
pbot/modules/qalc.pl
Pragmatic Software 8b8020c301 Update modules
2017-04-10 19:40:14 -07:00

26 lines
513 B
Perl
Executable File

#!/usr/bin/env perl
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
use warnings;
use strict;
my $args = join ' ', @ARGV;
my $qargs = quotemeta $args;
if (not length $qargs) {
print "Usage: qalc <expression>\n";
exit;
}
my $result = `qalc $qargs`;
$result =~ s/^.*approx.\s+//;
$result =~ s/^.*=\s+//;
print "$args = $result\n";
# print "$result\n";