Firstly, try some sanity checks; testing the
variables contain the expected values.
Data::Dumper is great for this, if you've not encountered it before.
Check that the paths to the files are feasable
Then put file tests in. -e -f -d, that kinda stuff.
Your script seems rather morbid. Try focussing more on living than dying.
--
Brother Frankus.