http://www.perlmonks.org?node_id=1033679


in reply to Review of my script

Firstly congratulations on being a neat and organised developer.

Apart from the issues mentioned in other comments, if you are developing a module or even a script, consider tacking a POD description at the end of it. Its the easiest way of providing documentation on what your script does and how it works.

Please try to limit the use of "global" parameters. Your MySQL and Postgres routines should be passed all the data they need to work as parameters instead of picking up globals like @args.yes i know variables declared with my have local scope in the enclosing block, but in this case there is no enclosing block

You should perhaps have a hash mapping the routine to the engine

Something like:

my %engineMap = ( 'mysql' => \&mysql, 'postgres' => \&postgres ); if ($engineMap{$engine}) { $engineMap{$engine}->(@args); } else { print "Unknown database engine\n"; showUsage(); }
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)