diff options
author | Andinus <andinus@nand.sh> | 2020-05-06 05:23:04 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-05-06 05:23:04 +0530 |
commit | 9db486d8355a8bee04a31739754a06b06b057f23 (patch) | |
tree | edb34d8a66eb445e59e7a772ac990c2d3907caa2 | |
parent | 62c9d097be7679ecce869dd053a190cc45a89dbd (diff) | |
download | pictor-9db486d8355a8bee04a31739754a06b06b057f23.tar.gz |
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
-rwxr-xr-x | pictor.pl | 10 |
1 files 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; }; |