in reply to Re^2: help needed in storing the return values of unpack
in thread help needed in storing the return values of unpack

Any array you give as a parameter will gobble up all remaining items. So the following will work for you I guess:

my ($first, @rest) = unpack "U20A10A10A10", $string;

Replies are listed 'Best First'.
Re^4: help needed in storing the return values of unpack
by Anonymous Monk on Mar 23, 2006 at 09:45 UTC
    hai Corion,
    Your answer will not work. since U20 will return 20 elements,so the first element will be stored in $first , and remaining 19 elements and the strings returned by A10A10A10 will be stored in the array @second.

      Ooops - I thought that U returned a Unicode string and not single items, so my answer is wrong. You should go with GrandFather's approach and move the 20 items out of the array later:

      my @items = unpack "...", $string; my @first = splice @items, 0, 20;