in reply to Re^2: directory exists
in thread directory exists

You may be "suffering from buffering." Try switching off output buffering by adding the line $| = 1 somewhere before the print statement.

the lowliest monk