Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: Perl File Parsing - My Code Works, but it's Ugly!

by aaron_baugher (Curate)
on May 31, 2015 at 21:29 UTC ( [id://1128505]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1128505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found