Theo has asked for the wisdom of the Perl Monks concerning the following question:
The first line returns the error message: Global symbol "$counter" requires explicit package name at TnImg.pl line 16.
It gives the same message if the var is preceeded by 'my'.
I'm using strict and the -w.
Can some kind soul point me towards the solution?
$counter = 0; # add link text to each filename foreach my $name (@filenames) { if ($counter % 2){ #odd rows $name = qq{<tr><td><img align="center" valign="center" src="TN/tn_ +$name" width="75" height="42"> <a href="$name">$name</a></td>\n}; }else{ #even rows $name = qq{<td><img align="center" valign="center" src="TN/tn_$nam +e" width="75" height="42"> <a href="$name">$name</a></td></tr>\n}; } $counter++; }
This is my first perl question, so I may have left out something important.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error msg "requires explicit package name"
by sauoq (Abbot) on Jun 16, 2003 at 23:07 UTC | |
|
Re: Error msg "requires explicit package name"
by webfiend (Vicar) on Jun 16, 2003 at 23:09 UTC | |
|
Re: Error msg "requires explicit package name"
by Zaxo (Archbishop) on Jun 16, 2003 at 23:20 UTC | |
by Theo (Priest) on Jun 17, 2003 at 02:54 UTC | |
|
Re: Error msg "requires explicit package name"
by sgifford (Prior) on Jun 17, 2003 at 03:52 UTC | |
by Theo (Priest) on Jun 17, 2003 at 04:19 UTC | |
by sgifford (Prior) on Jun 17, 2003 at 06:42 UTC | |
|
Re: Error msg "requires explicit package name"
by dvergin (Monsignor) on Jun 17, 2003 at 07:21 UTC | |
|
Re: Error msg "requires explicit package name"
by Theo (Priest) on Jun 17, 2003 at 14:30 UTC |