The first if statement will print the value is not present and the next will print Value is present....Why???How can i rectify it?????????@arr1=qw(a b c d e sdf); $val1="http://www.google.com/home?sFocus=(sFocus.value)&sLis +t=(sList.value)"; push(@arr1,$val1); $val="sdf"; if(grep(/$val1/i,@arr1)) { print "Value is present\n" ; } else { print "Value is not present\n"; } if(grep(/$val/i,@arr1)) { print "Value is present\n" ; } else { print "Value is not present\n"; }
In reply to Search for array element by ashok13123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |