in reply to nested while loops

Hi Sivaratna,

1) ALWAYS "use strict;" and "use warnings;" These pragmas will reveal a lot of errors, and unexpected situations, like for example a variable being empty when you expected it to have a value, because you'll get a warning about it being "uninitialized" -- this will tip you off to where the problem is.

2) Learn to use the Data::Dumper module as you develop your code. Then you can liberally use debugging statements that will show what is in the variables at each step of your program, rather than just waiting until the end to see whether or not it failed. Like this:

#!perl use strict; use warnings; use feature qw/ say /; use Data::Dumper; use Algorithm::Permute; ## Some code here that produces @prdct ... my $product = Algorithm::Permute->new( \@prdct ); say Dumper( $product ); # did you get what you expected? while ( my @res = $product->next ) { say Dumper( @res ); # now did you get what you expected? # do something else ... }

Remember, laziness is a virtue for a programmer, but laziness may not be what you think it is! Put in the work to make your code pass through strict, warnings, Perl::Critic, and so on, and put in the work to add debugging info and testing, and your life will be easier as you go forward!!