In terms of pseudo-code, your task sounds sort of like this:
declare a "master" array that will hold a set of arrays
declare a max_array_size variable, initially set to zero
for each input file {
read its lines into a new array
if the size of this array (# of lines in file) > max_array_size {
update max_array_size to this new value (size of current array)
}
push a reference to this array onto the "master" array.
}
for each index ( 0 .. max_array_size -1 ) {
join the values at master[0..$#master][index] into a comma-delimite
+d string
# note that some of the values in that set may be undef
print the resulting string
}
HTH.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|