in reply to Checking MD5 of files in directory with corresponding MD5 file type

You even have the logic to process the items from the getfiles subroutine already in place.

Maybe start with the following implementation for routine to see what happens:

sub routine { # identify filepath and name as parameters passed to routine my $file = shift; my $name = shift; print "routine called with '$file', '$name'\n"; }

The next thing would be to give it a proper name. Find out what the routine should do, and then rename it to that.

Good names could be process_file or verify_md5 maybe. Or maybe the routine should do something different, but then its name should be different as well.

Replies are listed 'Best First'.
Re^2: Checking MD5 of files in directory with corresponding MD5 file type
by deedo (Novice) on Dec 30, 2016 at 10:31 UTC

    Thanks Corion... I think where I am struggling the most is how to process two files in tandem from the array... i.e. file and file.md5

    What I am trying to achieve is to generate the MD5 of 'file' which already has been generated from an instrument prior to transfer and stored in a corresponding file called file.md5

    Just how I get to work with these two files separately but concurrently from the rest of the array is what is failing me at the moment

      Why do you want to process both, "file" and "file.md5"?

      I think you want to do something different with "file" than you want to do with "file.md5".

      Also note that if you know "file", you also know "file.md5", and if "file.md5" is not found that is an error.

      You can blindly open "file.md5" without needing to verify its existence beforehand.

        The way I was looking at it was that I would process the MD5 of 'file' and then open 'file.md5' and hold its content in memory to compare to the processed MD5 of 'file' - if that makes sense... then if it matches move to the next file and corresponding .md5 file and if there is an error, send it to the logmd5 subroutine for logging