in reply to Re: Building ARRAY with grep expression NOT working
in thread Building ARRAY with grep expression NOT working
• I've used postfix versions of unless and for to reduce the number of indented blocks.
Which makes it harder for some (me) to read the code.
The reason I answer is not because of that, but because of the wrong reason you state with it. It is easy to not have indentation and stil not use postfix unless and if as you already showed on line 7. I would prefer
#!/usr/bin/env perl use strict; use warnings; my %ujs; my $file = "access_log.txt"; open my $fh, "<", $file or die "File $file not opened: $!\n"; while (<$fh>) { m/([^\/]*\.js)$/ and $ujs{$1}++; } close $fh; print "$_\n" for sort keys %ujs;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Building ARRAY with grep expression NOT working
by GrandFather (Saint) on Apr 01, 2020 at 07:29 UTC | |
|