$MAIN[$seq_unique][$seq_position] = \(@array[1 .. 21]);

It seems you are making a couple mistakes with that.

First, \(@array[1 .. 21]) returns a list of references to the elements in that array slice. I.e. it is the same as:

( \$array[1], \$array[2], . . ., \$array[21] );
That's probably not what you want.

Your other mistake is that you are assigning a list to a scalar. The result will be that the scalar will equal the last item in the list. So, you code is really the same as:

$MAIN[$seq_unique][$seq_position] = \$array[21];
So, it's a reference to a scalar, and that's why, when you print it, you get that SCALAR(0x236ac8).

I'm not sure how to tell you to fix it because it isn't obvious what you want. Do you want that to hold a reference to an array, which is what it looks like you were trying to achieve with \(@array[1 .. 21])? Or do you want it to hold a readable string, which is what it seems you want if you are trying to print it out?

-sauoq
"My two cents aren't worth a dime.";

In reply to Re: Array output as SCALAR by sauoq
in thread Array output as SCALAR by MrMadScience

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.