Thread empty Files (9 answers)
Opened by paidopoieo at 2005-12-07 03:12

paidopoieo
 2005-12-08 01:26
#60741 #60741
User since
2005-12-02
96 Artikel
BenutzerIn
[default_avatar]
Hi,
Sorry, ich haett da noch eine Frage....derselbe Code.....
nur diesesmal hab ich mein File sortiert.....und will alle doppelten rausloeschen und in ein neues File schreiben.....

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl -w

my @raw_data;
my $wrestler;
my @work_array;
my $wrestlerPrevious = '';

print "Starting Program......Hopefully.....\n";

open (sortedFile, "Out.txt") || die ("Could not open file. $!");
print "File sortedFile openend successfully \n";

@raw_data = <sortedFile>;
print "stored entire file in Array \n";
close (sortedFile);
print "closed file sortedFile \n";
print "\n";

print "trying to enter foreach....\n";
print "\n";

#======================================================================================
foreach $wrestler (@raw_data) {
print "entered foreach successfully \n";


#print $wrestler, "\n";
#@work_array = $wrestler;
#print "trying to enter if Condition....\n";
if ($wrestler !~ m/$wrestlerPrevious/) {
print "if condition entered successfully\n";



open (cleaned_Blasthits_wo_AlignmentsFile, ">>cleaned_Blasthits_wo_AlignmentsFile.txt") || die ("Could not open file. $!");

print "File cleaned_Blasthits_wo_AlignmentsFile opend successfully \n";

print cleaned_Blasthits_wo_AlignmentsFile $wrestler;

close (cleaned_Blasthits_wo_AlignmentsFile);
} else {



print "THAT WAS A DOUBLED ONE....SORRY \n";

}

$wrestlerPrevious = $wrestler;
}
print "finished foreach \n";


nur das Problem ist, das Programm geht mir die ersten beiden Male immer in den else Zweig....und bricht dann ab......

Sorry ich bin nicht sehr gut in Perl.....bin kein Programmierer....

mfg
Hubert

View full thread empty Files