in reply to Building ARRAY with grep expression NOT working
Here is your code modified in a few ways:
The rest of your variable names have been left the same. If I were writing this myself I would lowercase them all but that's purely a stylistic thing.
#!/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: $!"; while (my $String = <$FH>) { next unless $String =~ /([^\/]*\.js)/; $ujs{$1} = 1; } close $FH; print "$_\n" for sort keys %ujs;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Building ARRAY with grep expression NOT working
by jwkrahn (Abbot) on Apr 01, 2020 at 01:49 UTC | |
|
Re^2: Building ARRAY with grep expression NOT working
by Tux (Canon) on Apr 01, 2020 at 06:08 UTC | |
by GrandFather (Saint) on Apr 01, 2020 at 07:29 UTC | |
| |
|
Re^2: Building ARRAY with grep expression NOT working
by denting24by7 (Initiate) on Apr 02, 2020 at 04:58 UTC | |
by hippo (Archbishop) on Apr 02, 2020 at 10:01 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |