http://www.perlmonks.org?node_id=581662


in reply to Why "use of uninitialized value" warning comes?

use strict; use warnings; my $incr=0; my @need = qw(sanjay samir sanjay sudha jasmin sanjmay); my @array1; for my $elem(@need) { if ($elem=~ qr/^sanj/){ push @array1,$elem } } print @array1;