Thank you all for your help. I really appreciate it.
The following got me where I needed to be...
foreach $an ( keys %GrepPatternHash ) {
chomp($an);
@GrepResults = grep (/$an/, @TargetList);
Mark.
Rather than posting the actual data at this time, how about this:
filea contains...
abc
def
ghi
fileb contains...
abc
zabcd
yza
When my original script is run, it returns:
abc
With Kevin's suggested modification,
grep (/$GrepPatternHash{$_}/, @TargetList);
...it returns...
zabcd
yza
The...
Thanks Kevin.
I tried your suggestion and it returned inverse results to what I was getting, i.e. I got everything back except precise matches.
It behaved as though I had specified ! like so:
grep (! $GrepPatternHash{$_}, @TargetList);
So, for kicks, I tried your suggestion again, but with...
Hi.
I'm new to perl, and not expert in any particular programming language.
I've written a script that does the following:
1) Takes a list in FileA as input to a hash (%GrepPatternHash).
2) Takes a list in FileB as input to an array (@TargetList).
2) Uses the elements of that hash as the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.