in reply to Count Messages for each minute, 2D array error
The short answer: $count_message[$hh1][$mm1]
The long answer: There's no such thing as a 2d array in Perl. However, you can store references to arrays (including references to anonymous arrays) in arrays, effectively creating a 2d array.
$a[$i][$j]
is short for
$a[$i]->[$j]
which, thanks to autovivification, is short for something like
$a[$i] ||= []; $a[$i]->[$j]
See perllol
That said, you might be better off with a hash keyed on "hh:mm" rather than an array. I also avoid each since it prevents the use of last and die.
|
|---|