strict is now applied and all is working well. It took a little time but also highlighted a few not so obvious errors. Your responses also gave me some good tips and left me with a couple of questions.
What's the difference between these two lines of code and why use the first when the second will work?
Not everyone would endorse this form of list initialisation BrowserUk(my $timestamp,my $page,my $userURL,etc) = split('\|',$line); my ($timestamp,$page,$userURL,etc) = split('\|',$line); # which is muc +h cleaner.
This seems like a easy, clean way to initilize. Any comments? Also, can variables be declared as in the second line?my ($var1,$var2,$var3) = ('','',''); my ($var4,$var5,$var6);
BTW, that looks like you're doing a test on an uninitialized array element (graff) You're right! So!! Another good tip on an in-line initilizing technique. (BrowserUk)
I see this piece of code. (Notromda). Could this also be written as on line 2 and what's the difference?my %hits for (....) { .. $hits{$page} = [0,0,0,0] unless exists $hits{$page}; $hits($page}[0]++; .. }
print $pages{"page1"}->[1]; print $pages{"page1'}[1];
In reply to Re: Problems with 'strict' and variables created on the fly
by nedals
in thread Problems with 'strict' and variables created on the fly
by nedals
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |