minor syntactic changes

I've changed a couple things that are recommended by Perl Best Practices. Namely uncuddled the "else" blocks and localise the $@ when using eval.