Project 320 BEtoThes4.pl



#!/usr/bin/perl

#reminder: make the file executable with:
# e.g.     chmod a+rx template.pl

open(OBE,"th.BE.txt");
@lines = ;
close(OBE);

#remove # (uncomment) from the next line if you want to verify file was read
#print @lines;  



for ($a=1; $a<$#lines; $a=$a+1) {
	
	if ($lines[$a] eq $lines[$a+14]) {
		$lines[$a] =~ s/1/8/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] $lines[$a+5] $lines[$a+7] $lines[$a+9] $lines[$a+11] $lines[$a+13] $lines[$a+15] \n";
		$a=$a+15;
	}

########
	elsif ($lines[$a] eq $lines[$a+12]) {
		$lines[$a] =~ s/1/7/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] $lines[$a+5] $lines[$a+7] $lines[$a+9] $lines[$a+11] $lines[$a+13] \n";
		$a=$a+13;
	}

########
	elsif ($lines[$a] eq $lines[$a+10]) {
		$lines[$a] =~ s/1/6/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] $lines[$a+5] $lines[$a+7] $lines[$a+9] $lines[$a+11] \n";
		$a=$a+11;
	}

########
	elsif ($lines[$a] eq $lines[$a+8]) {
		$lines[$a] =~ s/1/5/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] $lines[$a+5] $lines[$a+7] $lines[$a+9] \n";
		$a=$a+9;
	}

########
	elsif ($lines[$a] eq $lines[$a+6]) {
		$lines[$a] =~ s/1/4/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] $lines[$a+5] $lines[$a+7] \n";
		$a=$a+7;
	}

########
	elsif ($lines[$a] eq $lines[$a+4]) {
		$lines[$a] =~ s/1/3/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] $lines[$a+5] \n";
		$a=$a+5;
	}

########
	elsif ($lines[$a] eq $lines[$a+2]) {
		$lines[$a] =~ s/1/2/;
		print "$lines[$a] $lines[$a+1] $lines[$a+3] \n";
		$a=$a+3;
	}
	
########
	else { 
		print "$lines[$a] $lines[$a+1] \n";
		$a=$a+1
	}

}