From 86c20031bc9fe752d4c366fb6e3d4170ed0c0eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Fri, 1 Mar 2024 18:00:15 +0100 Subject: [PATCH] Use // operator for args/flags default values. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolás Ortega Froysa --- pacundo.pl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pacundo.pl b/pacundo.pl index cfac918..537da2f 100755 --- a/pacundo.pl +++ b/pacundo.pl @@ -31,10 +31,6 @@ use File::ReadBackwards; my $VERSION = "1.0"; my $PROG_NAME = "pacundo"; -my $r_flag = 0; -my $dry_run = 0; -my $num_txs = 1; - sub print_version { print("$PROG_NAME v$VERSION\n"); } @@ -73,9 +69,9 @@ if ($opts{'v'}) { exit 1; } -$r_flag = 1 if ($opts{'r'}); -$dry_run = 1 if ($opts{'d'}); -$num_txs = $opts{'t'} if ($opts{'t'}); +my $r_flag = $opts{'r'} // 0; +my $dry_run = $opts{'d'} // 0; +my $num_txs = $opts{'t'} // 1; my $pacman_log = File::ReadBackwards->new("/var/log/pacman.log") or die("Failed to load pacman log file.\n$!");