in reply to Re^2: Perl File Parsing - My Code Works, but it's Ugly!
in thread Perl File Parsing - My Code Works, but it's Ugly!

You can error-check mkdir much like you do open:

mkdir $newdir or die "Unable to mkdir $newdir : $!";

That's true of most commands in Perl; they return true if successful and false on failure, so you can use "do_this() or show_error()" logic. (One exception is system, which returns the return value of the underlying command, which (on Unix at least) is zero on success, so you have to watch out for that.)

Aaron B.
Available for small or large Perl jobs and *nix system administration; see my home node.