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


in reply to looking for feedback on my first script

Hello thirtySeven,

at first glance it seems ok. About arguments of the script: no one rembemer the correct order of them after 2 minutes. See The Dynamic Duo --or-- Holy Getopt::Long, Pod::UsageMan! for more info. I always use the following format:

unless ( GetOptions ( "example=s" => \$par_example, # string needed # more options a +nd switches.. "help" => \$par_help, # switch )) { my_show_help(); die "Error in command lin +e arguments: $!"} if (defined $par_help){my_show_help();exit;}

Then you can use File::Spec to a more robust path creation and look for a date module to see if it helps managing date formats.

Always check the return value of open and opendir like in: .. or die "Unable to open directory [$dir]"

You can use eval inside a block to mask the scope of $@ and check $^E (last operating system error) too.

When shelling out with system or whatever you can check it better with Capture::Tiny

my ($stdout, $stderr, $exit) = capture { system( $cmd, @cmdargs ); };

L*

PS my last suggestion is to follow haukex's sugestions :)

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.