gvinu4u has asked for the wisdom of the Perl Monks concerning the following question:
Hi all, this is the program that I have and working fine except one issue
In addition to the expected output I get the below for every iteration, not sure as why I'm getting it.my $xml_file = "Modfile.xml"; open my $list, $xml_file or die "Could not open $file: $!"; my $count = 1; while( my $line = <$list> ) { my ( $subfamily ) = $line =~ /suite subfamily="(.*?)"/; print "The Sub Family is $subfamily \n "; if ($subfamily =~/[a-z]/){ my ( $name ) = $line =~ /" name="(.*?)"/; print "The Name is $name \n "; } if ( $name = ~/[a-z]/) { my ( $family ) = $line =~ /" family="(.*?)"/; print "The Family is $family \n "; } last if ++$count == 3; $count ++ ; } close File;
Use of uninitialized value $subfamily in pattern match (m//) at Test.pl line 34, <$list> line 59.
Use of uninitialized value $_ in pattern match (m//) at Test.pl line 39, <$list> line 59.
Use of uninitialized value $family in concatenation (.) or string at Test.pl line 41, <$list> line 59.
line 34 is-->if ($subfamily =~/a-z/)
line 39 is--> if ( $name = ~/a-z/)
|
|---|