#!/usr/bin/perl ##parser3.plx use strict; use warnings; use diagnostics; #call up variables my(@array); my($file, $filename1, $filename2, $line, $i, $tmp); $i = 1; $filename2 = ''; #opens a list of the files that need processing open LIST, 'listA' or die "(L1)We've got a problem: $!"; while () { $filename1 = ; fileswitch(); $file = $_; #opens the actual file that will be processed open FILE, "$file" or die "(L2)We've got a problem: $!"; while () { $line = $_; #-----------------$1----$2-----$3------$4---$5------$6 if($line =~ /\s+([-*])(\d+)\.(\d+)\s+([-*])(\d+)\.(\d+)\s*/g) { #Append the coordinates (with the '-' sign where appropriate) push(@array, "$1$2.$3 || $4$5.$6 \n"); } } #close file close(FILE); } #close list close(LIST); #print to file p2f(); #check if path stays the same, if not then append a note to the database sub fileswitch { if($filename1 ne $filename2) { push(@array, "Path: $filename1\n"); #print "\n $filename1 \n" ; #print (".pkt file parsing completed. \n"); } else { $filename2 = $filename1; } } #print to file sub p2f { open (COORDLIST, '>>coordinates'); print COORDLIST @array; close(COORDLIST); }