Think about Loose Coupling | |
PerlMonks |
Re: how to repeat a if else statement in a nested for loopby Random_Walk (Prior) |
on Jun 19, 2015 at 06:32 UTC ( [id://1131105]=note: print w/replies, xml ) | Need Help?? |
First off, welcome to the Monastery. We hope you enjoy your stay. Looking at your post, it is hard to understand what you are trying to achieve. Your specification is not so clear. But lets we what we can do...
First off you define two arrays of words, but later only one is used. Perhaps this is a clue...
Is this here to count the words in @a1 and set $i? If so we can skip it, and go an easier way later on
OK, so we have two loops, counting from 0 to $i. We have a $d in there that I don't think you use again. Then we print out a line, when the iterators are not equal. All very mysterious. Wild GuessPerhaps you are trying to compare the words in the lists? I see two word lists, and some initialisation based on the length of one of them. We may not even need nested loops. If that's what you are after, how about something like this...
Like I said, a wild guess. Please do update your specification, so we can help a little more Cheers,
Pereant, qui ante nos nostra dixerunt!
In Section
Seekers of Perl Wisdom
|
|