in reply to Mapping list to hash is dropping list items
This may work better (UNTESTED):
#!/usr/bin/perl use strict; use warnings; my @allTags; { local @ARGV = <[0-9][0-9][0-9][0-9].txt>; my %uniqueTags; while ( my $line = <> ) { next unless $line =~ s/^tags\s+//; $line =~ s/\s+\z//; $uniqueTags{ $_ } = 1 for split /\s+,\s+/, $line; } @allTags = keys %uniqueTags; } print "@allTags\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Mapping list to hash is dropping list items
by almsdealer (Acolyte) on Mar 16, 2022 at 16:28 UTC | |
by Fletch (Bishop) on Mar 16, 2022 at 17:14 UTC |