in reply to searching in array
I assume you meant
In that case, you can use grep@arr = qw(test1 @test2 @test3 test4 test5);
Or you could use a foreach loop, push onto either of two arrays depending on the match, then join afterward.$str1 = join(',', grep {/^@/} @arr); $str2 = join(',', grep {/^[^@]/} @arr);
|
---|
In Section
Seekers of Perl Wisdom