3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-16 17:09:33 +01:00
pbot/modules/qalc.pl
2021-07-10 15:00:22 -07:00

24 lines
404 B
Perl
Executable File
Vendored

#!/usr/bin/env perl
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT
use warnings;
use strict;
my $args = join ' ', @ARGV;
if (not length $args) {
print "Usage: qalc <expression>\n";
exit;
}
my $result = `ulimit -t 2; qalc '$args'`;
$result =~ s/^.*approx.\s+//;
$result =~ s/^.*=\s+//;
print "$args = $result\n";
# print "$result\n";