http://qs321.pair.com?node_id=581661

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 test10.pl line 9
sanjaysanjaysanjmay
Plz. suggest me some suitable code to avoid the above warning?