Grep to find item in Perl array

后端 未结 6 2142
名媛妹妹
名媛妹妹 2021-02-04 03:51

Every time I input something the code always tells me that it exists. But I know some of the inputs do not exist. What is wrong?

#!/usr/bin/perl

@array = <&g         


        
6条回答
  •  眼角桃花
    2021-02-04 04:21

    You can also check single value in multiple arrays like,

    if (grep /$match/, @array, @array_one, @array_two, @array_Three)
    {
        print "found it\n";
    }
    

提交回复
热议问题