more useful options | |
PerlMonks |
Re: perl6 phasers and a 1 linerby RichardJActon (Novice) |
on Feb 14, 2018 at 14:36 UTC ( [id://1209142]=note: print w/replies, xml ) | Need Help?? |
Thank You Monks, I setteled on: perl6 -ne 'my $ids; BEGIN {$ids="patternFile.txt".IO.lines.Set}; my @F=$_.split("\t"); if @F[0] (elem) $ids {@F.join("\t").say}' searchFile.txtMuch as Anonymous Monk suggested but with Laurent_R's use of declaring $ids outside of the BEGIN block / before the BEGIN phaser. I think that Anonymous Monk's original suggestion would have re-read the patternFile on every line which would be inefficient. In retrospect I clearly had an equivocation in my mental model of what lines does a I used it to pull in all the lines for the first file and then tried to used it a bit like <> from perl5 to read in 1 line at a time from STDIN. Thanks again!
What is true is already so. Owning up to it doesn't make it worse. - Eugene Gendlin
In Section
Seekers of Perl Wisdom
|
|