in reply to Seemingly odd issue with push in foreach loops?

btw you can replace your foreach loop with grep:

@test3 = grep { /md/ } @test;

or if you like to be verbose

@test3 = grep {$_ =~ /md/ } @test;