For searching the presence of a value in an array in Perl, we can use following code :
#!/usr/bin/perl -w
my @arry=('asd','hhf','qw33','dfd','ppq');
my $search_value='asd';
if($search_val ~~ @arry) {
print "Value '$search_val' is present in the given array...";
}
The program will give an output as follows if the search value is present in the array.
Value 'asd' is present in the given array...
You must be logged in to post a comment.