my @common_lines = do { local @ARGV = ( 'list1.txt', 'list2.txt' ); my %data; while ( <> ) { next unless /\.tst$/; if ( @ARGV ) { $data{ $_ } |= 1; } else { $data{ $_ } |= 2; } } grep $data{ $_ } == 3, keys %data; };
In reply to Re: Extract common lines from 2 files
by jwkrahn
in thread Extract common lines from 2 files
by great_riyaz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |