sanjay nayak has asked for the wisdom of the Perl Monks concerning the following question:

use strict; use warnings; my $incr=0; my $incr1=0; my @need = qw(sanjay samir sanjay sudha jasmin sanjmay); my @array1=""; for(;;) { last if $need[$incr] eq ''; if ($need[$incr]=~ qr/^sanj/) { $array1[$incr1]= $need[$incr]; $incr1++; } $incr++; } print @array1;
When i run this program it shows
Use of uninitialized value in string eq at line 9
Plz. suggest me some suitable code to avoid the above warning?