#!/usr/bin/perl -w @files = ; foreach $file (@files) { print $file . "\n"; open(IN,$file) || die ("Could not open file"); open(OUT131,'>>/myhome/outgoing/data131.txt'); open(OUT186,'>>/myhome/outgoing/data186.txt'); open(OUT999,'>>/myhome/outgoing/data999.txt'); while ( ne "") { my $line = IN; chomp($line); my $firstchar = substr($line,0,1); if($firstchar eq "#") { next; } my ($var1,$var2,$var3,$var4,$var5,$var6,$var7,$var8,$var9,$var10,$var11,$var12,$var13)=split(/\|/, $line); #variables are separated by commas. my $type = substr($var8,0,3); if($type eq 131) { print OUT131 $line . "\n"; } elsif($type eq 186) { print OUT186 $line . "\n"; } else { print OUT999 $line . "\n"; } } close(IN); close(OUT131); close(OUT186); close(OUT999); my $newfile='/roamdev/htdocs/RIEFID/incoming/processed/new_file.txt'; #use File::Copy; #move($file, $newfile) or die "The move operation failed: $!"; } exit 0;