3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-06 11:28:43 +02:00

modules/qalc.pl: refactor and clean-up ugly code

This commit is contained in:
Pragmatic Software 2021-08-02 17:52:38 -07:00
parent a0e2ba3610
commit f6665969ac

10
modules/qalc.pl vendored
View File

@ -6,18 +6,14 @@
use warnings; use warnings;
use strict; use strict;
my $args = join ' ', @ARGV; if (not @ARGV) {
if (not length $args) {
print "Usage: qalc <expression>\n"; print "Usage: qalc <expression>\n";
exit; exit;
} }
my $result = `ulimit -t 2; qalc '$args'`; my $result = `ulimit -t 2; qalc \Q@ARGV\E`;
$result =~ s/^.*approx.\s+//; $result =~ s/^.*approx.\s+//;
$result =~ s/^.*=\s+//; $result =~ s/^.*=\s+//;
print "$args = $result\n"; print "@ARGV = $result\n";
# print "$result\n";