in reply to variable list assignment

$record[$_]->{bytes} = [get_bytes($num)]->[$_] for 0..$num;
but you'll better not use this, because get_bytes will be invoked $num times! And this is really ineffective.

addition:
but your three lines of code next to @tmp assignment better written as:

$record[$_]->{bytes} = $tmp[$_] for 0..$#tmp;

Courage, the Cowardly Dog

Replies are listed 'Best First'.
Re: Re: variable list assignment
by arc_of_descent (Hermit) on Aug 03, 2002 at 11:11 UTC

    And this is also not what i want. :-)
    get_bytes should be invoked only once

    Thanx

    --
    arc_of_descent

      I see your point, and can understand a situation when get_bytes gets bytes from file and it is wrong to call it more than once. But anyway, as you did not specified that restriction (also performance considerations were not mentioned), my answer formally should fit...

      Courage, the Cowardly Dog