Re: What's being thrown away?
- From: krahnj@xxxxxxxxx (John W. Krahn)
- Date: Sun, 31 Dec 2006 03:57:23 -0800
Mathew Snyder wrote:
In the following snippet of code I'm getting the "useless use of a private^^^^^^
variable in a void context" error. It is at line 64 which is the closing brace
for the for loop.
for ($count; $count < 7; $count++) {
$count is in a void context there. Either:
for ( my $count; $count < 7; $count++ ) {
Or:
for ( $count = 0; $count < 7; $count++ ) {
etc.
But it doesn't look like you are using $count inside the loop anyway so why
not just:
for ( 0 .. 6 ) {
And if you *really* need $count then:
for my $count ( 0 .. 6 ) {
if ($day == '01') {
You are using a numerical comparison on a string. Either:
if ( $day == 1 ) {
Or:
if ( $day eq '01' ) {
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
.
- References:
- What's being thrown away?
- From: Mathew Snyder
- What's being thrown away?
- Prev by Date: Re: Is item in array
- Next by Date: regex substitution question
- Previous by thread: Re: What's being thrown away?
- Next by thread: Re: What's being thrown away?
- Index(es):
Relevant Pages
|
|