How search a string in an array?

To search a content in an array in perl, we can use the following format,

my @a=('Hai','Leop','mac');
my @b = grep(/a/i, @a);
print join ",",@b;

The output will be as follows:

Hai,mac

Leave a Reply