in reply to Problems with 'strict' and variables created on the fly

I'm a little confused here -- sorry... When you say "it works fine when I don't use strict", what exactly do you mean by "works fine"? Does it actually do what you intend it to do? Or is it "fine" just because it doesn't report any errors?

I'm curious, because this part:

(my $timestamp, my $page, my $moredata) = split('\|',$line);
seems to conflict harshly with this part, which comes just two lines later:
@$page = (0,0,0,0) if ($$page[3] eq '');
BTW, that looks like you're doing a test on an uninitialized array element -- nothing could have been assigned to $$page[3] at the time it's evaluated in the "if" statement here, so the test is always true.

Then there's this third part a few lines later, which could coexist with either of the previous two:

$maxCount{'$page'}++;
The first part assigns a string to a scalar variable $page. The second part treats $part as a reference to an anonymous array, and if this works, it's because the earlier string value has been replaced (obliterated) by the array reference. The third part "stringifies" the array reference and uses it as a hash key.

So, okay, I guess it might work fine without "use strict"; the point is that strings read from input data have nothing to do with the names of variables here. When you use strict, the anon.array held in $page goes out of scope, has no other references to its content, and is reaped.

I would propose an alternate form for the first for loop that would make more sense: creating a new array, and setting the value of a hash element to be a reference to that array, or something of that nature -- but I can't quite make out your intentions in that code... Still, here's a try:

foreach my $line (@data) { (my $timestamp, my $page, my $moredata) = split('\|',$line); my @hits = localtime($timestamp); # Here I create and preset an array with a variable name defined b +y $page my @counters = (0,0,0,0); if ($hits[7] == $now[7]) { $counters[0]++; } if ($hits[4] == $now[4]) { $counters[1]++; } if ($hits[5] == $now[5]) { $counters[2]++; } $maxCount{$page} = \@counters; } my $dAry = ""; my $wAry = ""; my $mAry = ""; foreach my $page (keys %maxCount) { my @counters = @{$maxcount{$page}}; $dAry .= "$counters[0],"; $wAry .= "$counters[1],"; $mAry .= "$counters[2],"; }
Let me stress that this suggestion only serves to make a sensible use of variables and references -- I have no confidence that it would actually do whatever it is you're trying to do.