|
|
array search in perl using grep - Perl
|
Views : 2251
|
|
Tagged in : Perl
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
We can use grep in a if condition to check whether a string is in a array
Example:
@arrayy = ('search 1', 'search 2', 'search 3', 'search 4');
$test="search 2"
if (grep {$_ =~ $test} @arrayy) {
print "found";
}
|
|
By - rajesh, On - 2008-11-19 |
|
|
|