[Chicago-talk] specifying 2 variables as 1 hash key
Dooley, Michael
Dooley.Michael at con-way.com
Wed Dec 3 14:06:15 CST 2003
thanks for the suggestions:
1) please forgive my sloppiness I am trying to learn as I go (using
practical examples) so my technique is poor.
but this is what I have for my script so far.
2) if you have any suggestions it would be much appreciated provided they
are not way over my head.
this is a super ruff draft.
just getting one section to work at a time then stringing them together as I
go.
[qgatu003]/export/home/mxdooley/mbi_script$cat dfh
Qdfh1txt="dfh file 1"
Qdfh2txt="dfh file 2"
Qdfh3txt="dfh file 3"
[qgatu003]/export/home/mxdooley/mbi_script$ls files/
Qdfh1.txt.000 Qdfh2.txt.000
--- PERL CODE ---
#! /usr/bin/perl -w
# Purpose:
#1) to get a complete file list of inbound EDI Files
#2) Find correct DFH
#3) submit DFH+FILE to application
#4) archive file for backup
use strict;
open (DFH_FILE, "./dfh") or die "Can not read file ($!)";
my ($dfhtype,$dfh,%dfhhash);
foreach (<DFH_FILE>) {
chomp;
($dfhtype, $dfh) = split(/=/, $_);
$dfhhash{$dfhtype}=$dfh;
}
my (@files);
@files=glob("/export/home/mxdooley/mbi_script/files/*");
my ($file);
foreach $file (@files) {
open (EDI_FILE, "$file") or die "Can not read file ($!)";
open (ES_CLIENT, "|/usr/synthium/sun4.Solaris/bin/es_client -o
testing -t mail");
my ($client_code,$filetype);
$file=~s#.*/##;
($client_code, $filetype) = split(/\./, $file);
print ES_CLIENT $dfhhash{$client_code . $filetype},"\n";
while (<EDI_FILE>) {
chomp;
print ES_CLIENT "$_\n";
}
close ES_CLIENT;
close EDI_FILE;
}
--- EOF ---
More information about the Chicago-talk
mailing list