Hi Folks,
When i execute my script as below
it is coming out of the script after printing below statement. it is checking the wrong condition.. i dont know why. can someone please help?check_build_test_time_run_test.pl rel=102b file=ccmsg.2
[Error] - Wrongly passed the parameter. Please use correct format as below [Example] - <scriptname> rel=<release> file=<file_name>(./check_build_ +test_time_run_test.pl rel=102b file=ccmsg.1)
I am checking the input parameters passing to the script and validating the parameters before return. below is my subroutine.
Thank you..if ($no_of_arg == 2) { my($inp1,$inp2)=@ARGV; chomp($inp1,$inp2); print "inp1 is $inp1 inp2 is $inp2\n"; print "inp1 is $inp1 inp2 is $inp2\n"; my ($opt1,$value1,$opt2,$value2)=""; if ($inp1 =~ /^rel=\w+$/i) { ($opt1,$value1)=split(/=/,$inp1); } if ($inp2 =~ /^file=\w+$/i) { ($opt2,$value2)=split(/=/,$inp2); } if ($inp1 !~ /^rel=\w+$/i or $inp2 !~ /^file=\w+$/i) { print "\n[Error] - Wrongly passed the paramete +r.\n"; print " Please use correct format as +below\n"; print "\n[Example] - <scriptname> rel=<release +> file=<file_name>($script_name rel=102b file= ccmsg.1)\n\n"; exit; } return($value1,$value2); }
In reply to Checking Wrong Condition by Divakar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |