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 :)
In reply to Re: looking for feedback on my first script
by Discipulus
in thread looking for feedback on my first script
by thirtySeven
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |