in reply to loop thru 3-element array?

while (@dynval3) { # warning, eats it up my ($newname, $name, $val) = splice @dynval3, 0, 3; ... }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re^2: loop thru 3-element array?
by tachyon (Chancellor) on Sep 27, 2004 at 23:44 UTC

    The OP should be made aware that this example will destroy the contents of the @dynval3 array which may not be what is wanted. That is once you fix the typo in the splice as it is currently an infinite loop {chuckle}.

    cheers

    tachyon

Re^2: loop thru 3-element array?
by ysth (Canon) on Sep 28, 2004 at 06:47 UTC
    I do this like:
    my @tmp = @dynval3; while (my ($newname, $name, $val) = splice @tmp, 0, 3) { ... }