Note that $time++ modifies the element of @times, since 'for' makes $time an alias of each element. If that's undesirable, copy $time to another var at the top of the loop, and use that instead.use strict; use warnings; use Data::Dumper; my @times = qw(1000 1000 1000 1010 1010 1010); my $hash = {}; for my $time (@times) { $time++ while exists $hash->{$time}; $hash->{$time}->{one} = 1; $hash->{$time}->{two} = 2; } print Dumper $hash;
Dave.
In reply to Re: goto HACK
by dave_the_m
in thread goto HACK
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |