poj#!perl use strict; use warnings; my $infile = $ARGV[0]; my $outfile = $ARGV[1]; open IN,'<',$infile or die "Could not open $infile : $!"; my %count = (); my @lines = (); while (<IN>){ push @lines,$_; if (/^(\S+)/){ ++$count{$1}; } } close IN; open OUT,'>',$outfile or die "Could not open $outfile : $!"; for (@lines){ if (/^(\S+)/){ print OUT $_ if $count{$1} > 1; } } close OUT;
In reply to Re^5: how to change this code into perl
by poj
in thread how to change this code into perl
by perlnewbie012215
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |