in reply to EDI Store and Forward System

Scanning the code quickly, I see you use goto escape1, and the label escape1 appears at the end of block. This means you can replace the statement by a last or next instead. This is much more maintainable (which you state as a goal). People will have to have to ask themselves whether to add code before or after the label, and wonder what the difference is.

At the end of the script, there is another unconditional goto to somewhere above. This would be much better written as a while(1) { ... } loop or even { ...; redo}.

The comments are useless. You can't do anything with them, apart from reading them when looking at the code. If you want to comment that much, you should be doing it in POD. That way you can extract the documentation and do something with it with external tools

You are not checking to see whether your open calls are succeeding or not. Things could be broken and you wouldn't know about it.

I would write:

$excpdir=$defdev."/wxyzprod/wxyzexcp/"; $logfile=$defdev."/wxyzprod/wxyzlog.txt"; $indir=$defdev."/wxyzprod/wxyzin/"; $outdir=$defdev."/wxyzprod/suppliers/"; $archive=$defdev."/wxyzprod/wxyzarch/";
as
my $dir = '/wxyzprod'; $excpdir="$defdev$dir/wxyzexcp/"; $logfile="$defdev$dir/wxyzlog.txt"; $indir="$defdev$dir/wxyzin/"; $outdir="$defdev$dir/suppliers/"; $archive="$defdev$dir/wxyzarch/";

Factor out the common substrings. Use interpolation. It's easier to maintain (one change) and easier on the eyes (less keystrokes). I'd also use whitespace air the code visually.

If your statting a file to get its mtime, just say so.

($device,$inode,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctim +e, $blksize,$blocks) = stat($getinfile); my($timenow)=time; $delta=$timenow-$mtime; # versus $delta = time - (stat($getinfile))[9];

That way you don't have all those unused variables lying around.

And look for a way to factor out the blocks beginning with if (index($line,"ISA") == -1) into a subroutine. Any time you have large slabs of lines doing the same thing, it will be far more maintainable to have only one copy, and pass the information that changes via parameters.

Hope this helps.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'