#!/usr/bin/perl use Getopt::Long; &GetOptions('date=s' => \$date, 'dir=s' => \$directory, 'help' => \$help); &usage if ( defined $help || !defined $date ); my $PATH = "/Ack/$date/"; my $ftpoutbound = "/homes/ftpoutbound.db"; my %hash = (); opendir (DIR, $PATH) || die print "can't open dir $PATH at line 62 : $!\n"; my @FileList = readdir(DIR); close (DIR); foreach $FileList(@FileList) { next if $FileList =~ /^\.\.?$/; chomp $FileList; open (FILE, "$PATH$FileList") or die ("can't open $PATH$FileList :$!\n"); while() { @Fields = split /[\|\*~]/; # EDI data? $hash{$Fields[6]}{count}++ if ( $Fields[5] eq 'ZZ' ); # EDI? } } open (File, "$ftpoutbound") or die ("can't open $ftpoutbound at line ** : $!\n"); while () { chomp; my @fields = split /\;/; $fields[0] =~ s/\s+//; $hash{$fields[0]}{transport} = $FTP_fields[7] if defined $hash{$FTP_fields[0]}; } print "$_ - $hash{$_}{count} - $hash{$_}{transport}\n" for keys %hash; sub usage { print "blah blah blah\n"; exit 1; }