Software >> Development >> Languages >> Perl >> How to code a script to default to print command syntax if incorrect parameter read from command line

use File::Basename; $prog = basename(replacebegin:content:replaceend); if($#ARGV < 0) { ($s,$m,$h,$DD,$DM,$DY,$wday,$yday,$isdst) = localtime(); $thismth = sprintf "%04d-%02d", 1900+$DY,$DM+1; $today = sprintf "%04d-%02d-%02d", 1900+$DY,$DM+1,$DD; $now = sprintf "%02d:%02d:%02d", $h ,$m ,$s; } else { if ( $ARGV[0] !~ m/\d{4}[-]\d{2}/ ) { die "\nsyntax:\t$prog [yyyy-mm]\n\n\tyyyy-mm is the month to extract oracle errors for\n"; } else { $thismth = $ARGV[0]; } }