in reply to i thought i understood shift...
Also, learn to use the shortcuts of CGI.pm. Even Lincoln avoids the object-oriented form for short programs.
Some code:
Don't put the shift in the same expresssion as the splice. Order of execution not guaranteed. One other way to do it:my @array = qw(1 2 3 4 5 6 7 8 9); my %test; my $where = shift @array; $test{$where} = [splice @array, 0, 2]; ...
which is nice because it eliminates the intermediate variable. Even weirder:$test{$_} = [splice @array, 0, 2] for shift @array;
which still works because we know the shift has to happen before the splice.$_ = [splice @array, 0, 2] for $test{shift @array};
-- Randal L. Schwartz, Perl hacker
|
|---|