#!/usr/bin/perl -w use strict; 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 = ; 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"; 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";