in reply to Re: Re: Removing duplicates
in thread Removing duplicates
another approach to this step?
Of course! :-)
The idiomatic slurp goes something like this:
my $data = do { local (@ARGV, $/) = $filename; <> };
You may see why I chose to use File::Slurp originally. To integrate that into the second snippet, it would be:
#!/usr/bin/perl use strict; use warnings; my $file = shift or die "Usage: $0 file2 < another-file"; my $file_contents = do { local (@ARGV, $/) = $file; <> }; my $nets = join "|", map {chomp;$_} $file_contents; /$nets/ or print while <STDIN>;
Note: this code is untested.
Update: please note that some people get upset when you write "PERL." The language is called Perl, and the program that executes Perl code is called perl. Perl is not an acronym, so capitalizing its name makes it look like you're shouting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Removing duplicates
by RCP (Acolyte) on Mar 04, 2004 at 12:33 UTC |