From 9db486d8355a8bee04a31739754a06b06b057f23 Mon Sep 17 00:00:00 2001 From: Andinus Date: Wed, 6 May 2020 05:23:04 +0530 Subject: Fix variable name Variables shouldn't be called file, it's bad practice. So we use $fn for filename. http://perl-begin.org/tutorials/bad-elements/#sources_of_advice --- pictor.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pictor.pl b/pictor.pl index 6d4a523..fc24968 100755 --- a/pictor.pl +++ b/pictor.pl @@ -28,8 +28,8 @@ my @files = ( ); # Unveil each file with only read permission. -foreach my $file (@files) { - unveil( $file, "r" ) or +foreach my $fn (@files) { + unveil( $fn, "r" ) or die "Unable to unveil: $!"; } @@ -42,12 +42,12 @@ pledge( qw( rpath )) or die "Unable to pledge: $!"; # Search for acronym in every file. -foreach my $file (@files) { - open my $fh, '<', $file or +foreach my $fn (@files) { + open my $fh, '<', $fn or # The program should continue if the file doesn't exist but # warn the user about it. do { - warn "Unable to open $file: $!"; + warn "Unable to open $fn: $!"; next; }; -- cgit 1.4.1-2-gfad0