in reply to String searching in file
A quick untested example:
Using a hash lookup will be usually be much faster than greping your file or its content many times.open my $IN, "<", $awsLists or die "could not open $awsLists $!"; my %hash = map { chomp; $_ => 1 } <$IN>; close $IN; chomp @command; # just in case you need it. Note: you could choose a b +etter name for your array $hash{$_} = 1 for @command; open my $OUT, ">", "$awsLists.out" or die "could not open $awsLists.ou +t $!"; print "$_\n" for keys %hash; close $OUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: String searching in file
by cbtshare (Monk) on Feb 09, 2018 at 23:04 UTC |