Показать сообщение отдельно

  #11  
Старый 11.04.2010, 14:33
YuNi|[c
Участник форума
Регистрация: 17.09.2006
Сообщений: 248
С нами: 10340793

Репутация: 66
По умолчанию

Код:
#!/usr/bin/perl -w 
use strict; 
my $origfile = shift; 
my $outfile = "no_dupes_" . $origfile; 
my %hTmp; 
open (IN, "<$origfile") or die "Couldn't open input file: $!"; 
open (OUT, ">$outfile") or die "Couldn't open output file: $!"; 
while (my $sLine = <IN>) { 
next if $sLine =~ m/^\s*$/; #remove empty lines. Without this, still destroys empty lines except for the first one. 
$sLine=~s/^\s+//; #strip leading/trailing whitespace 
$sLine=~s/\s+$//; 
print OUT qq{$sLine\n} unless ($hTmp{$sLine}++); 
} 
close OUT; close IN;
для дубликата
 
Ответить с цитированием