Here is another solution using map for the inner loop. Note the use of 'say'. The newline would have been a problem with print.
>type anirbanphys2.pl use strict; use warnings; use feature 'say'; my @cell_file = qw( c_1_mm c_2_mm c_3_mm c_4_mm ); my @pvt_file = qw( 1 2 3 4 5 6 7 8 9 0 ); foreach my $pvt (@pvt_file) { say map { "${_}_$pvt "} @cell_file; } >perl anirbanphys2.pl c_1_mm_1 c_2_mm_1 c_3_mm_1 c_4_mm_1 c_1_mm_2 c_2_mm_2 c_3_mm_2 c_4_mm_2 c_1_mm_3 c_2_mm_3 c_3_mm_3 c_4_mm_3 c_1_mm_4 c_2_mm_4 c_3_mm_4 c_4_mm_4 c_1_mm_5 c_2_mm_5 c_3_mm_5 c_4_mm_5 c_1_mm_6 c_2_mm_6 c_3_mm_6 c_4_mm_6 c_1_mm_7 c_2_mm_7 c_3_mm_7 c_4_mm_7 c_1_mm_8 c_2_mm_8 c_3_mm_8 c_4_mm_8 c_1_mm_9 c_2_mm_9 c_3_mm_9 c_4_mm_9 c_1_mm_0 c_2_mm_0 c_3_mm_0 c_4_mm_0
Bill

In reply to Re: Merging of custom array by BillKSmith
in thread Merging of custom array by anirbanphys

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.