I have a file "file1" that contains:
dave
bob
rich
jim
I have a second file "file2" that contains:
dave
rich
I need "file2" listing to remove lines from "file1"
to create a "file3" that contains only:
bob
jim
I tried this code:
#!/usr/bin/perl
use strict;
# use warnings;
open(MYOUTFILE, ">file3");
open(MYOUTFILE, ">>file3");
my $file = shift
or die "Usage: $0 file1 < file2";
my $file_contents = do { local (@ARGV, $/) = $file; <> };
my $nets = join "|", map {chomp;$_} $file_contents;
/$nets/
or print MYOUTFILE
while <STDIN>;
close(MYOUTFILE);
But it does not get me my example of file3 should look like.
Help! Thanks.. RCP