Hi, I have several arrays in my script and if I want to execute my script using one array, on the command prompt, I will be executing the script with $ARGV[1] as the array name. I want to check if the tags (enclosed in < and >) are not outside what is mentioned in the array. I have a subroutine to check this as below.
sub validate_tag { my $arr1=$ARGV[1]; while($_ =~ /<(.+?)>/g) { $found=0; for my $x (0..$#arr1) { if($arr1[$x] eq $1){$found++} } if($found < 1){print "Invalid tag $1 found"} } }
$#arr1 is not returning the correct count of elements in the array. Could anyone help me on this?
In reply to Reading a array by rsriram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |