Use // operator for args/flags default values.

Signed-off-by: Nicolás Ortega Froysa <nicolas@ortegas.org>
This commit is contained in:
Nicolás A. Ortega Froysa 2024-03-01 18:00:15 +01:00
parent bea2957889
commit 86c20031bc

View File

@ -31,10 +31,6 @@ use File::ReadBackwards;
my $VERSION = "1.0"; my $VERSION = "1.0";
my $PROG_NAME = "pacundo"; my $PROG_NAME = "pacundo";
my $r_flag = 0;
my $dry_run = 0;
my $num_txs = 1;
sub print_version { sub print_version {
print("$PROG_NAME v$VERSION\n"); print("$PROG_NAME v$VERSION\n");
} }
@ -73,9 +69,9 @@ if ($opts{'v'}) {
exit 1; exit 1;
} }
$r_flag = 1 if ($opts{'r'}); my $r_flag = $opts{'r'} // 0;
$dry_run = 1 if ($opts{'d'}); my $dry_run = $opts{'d'} // 0;
$num_txs = $opts{'t'} if ($opts{'t'}); my $num_txs = $opts{'t'} // 1;
my $pacman_log = File::ReadBackwards->new("/var/log/pacman.log") or my $pacman_log = File::ReadBackwards->new("/var/log/pacman.log") or
die("Failed to load pacman log file.\n$!"); die("Failed to load pacman log file.\n$!");