Think about Loose Coupling | |
PerlMonks |
Re: Joining Arrays?by Lawliet (Curate) |
on Dec 20, 2008 at 21:40 UTC ( [id://731812]=note: print w/replies, xml ) | Need Help?? |
Well, without indentation your code is difficult to read. Try wrapping it in <c></c> tags and format it to be readable by those unfamiliar with it. From a quick glance there are many errors (such as putting a \n after the semi-colon. Using warnings will catch that.) That being said, try (actually, don't try it -- just get inspiration from it :P)
The first three lines should be in all your Perl programs. Using warnings will catch a lot of stupid mistakes you will make and using strictures will keep you from making a lot of stupid mistakes. I think the rest of the code is self explanatory. Updated with more comments. Update 2: Ikegami reminded me (thanks ikegami :D) that you must chomp() each element of the arrays before you push it into @final to remove the newline at the end. And you didn't even know bears could type.
In Section
Seekers of Perl Wisdom
|
|