When you say
$bits{'one'}=@test;
you are really giving @test scalar context. That's why $new[0] the second time returned 3 - that's the number of elements in @test. Basically, you can't just lay these data structures on top of each other.
Try using a reference and dereferencing later:
my @test = ( qw / bing bong bang / ); print '['.$test[2].'] ['.$test[1].'] ['.$test[0]."]\n"; $bits{'one'}= \@test; my @new = @{$bits{'one'}}; print '['.$new[2].'] ['.$new[1].'] ['.$new[0]."]\n"; OUTPUT: [bang] [bong] [bing] [bang] [bong] [bing]
\@test is a reference to test, and  @{$bits{'one'}} accesses the reference ($bits{'one'}) and the @{} dereferences it. Have you tried perlreftut?


UPDATE:
Coruscate reminded me of one of my favorite methods of array reference that I forgot to mention - [@test]. Trust me, all the cool kids are doing it. I hear it's all the rage in Japan. Even though it isn't exactly the same as \@test, for your purposes it works the same.
UPDATE 2:
sauoq has a good point. Chatterbox discussion showed that in fact @{$bits{'one'}} = @test is much faster than [@test] and /@test anyway. Check out my pad for benchmarking details.

In reply to Re: A hash of lists by jweed
in thread A hash of lists by wolis

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.