If that's Text::CSV's print() method you're referring to, perhaps that documentation may help.

According to the documentation, your first line of code

$csv->print ($fh1, [$ifile, @cols, @matches ]);

appears to be syntactically correct. Print out the values of those variables, immediately before that line of code, and inspect them: this may help in tracking down your problem.

I've no idea what you're attempting to achieve with "*".@cols. It will concatenate an asterisk with the number of elements in @cols (i.e. @cols in scalar context). Here's an example:

$ perl -wE 'my @cols = qw{a b c}; say "*".@cols' *3

Here's some suggestions as to what I think you may want (but I really am guessing here):

$ perl -wE 'my @c = (1,2,3); say "*", @c' *123
$ perl -wE 'my @c = (1,2,3); say "*@c"' *1 2 3
$ perl -wE 'my @c = (1,2,3); say map { "*$_" } @c' *1*2*3
$ perl -wE 'my @c = (1,2,3); say "@{[ map { qq{*$_} } @c ]}"' *1 *2 *3

If you need more help, please read "How do I post a question effectively?" before posting again.

— Ken


In reply to Re: how to print text + array values at same time by kcott
in thread how to print text + array values at same time by Anonymous Monk

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.