as an aside, in older versions of perl (as recent as 5.005_03,) using $! with \n causes different results than $! alone. perhaps you'll get a different (better) error if you strip off the newline. i don't know if this is still the case, but i never use newlines with $! anymore.