Sandy has asked for the wisdom of the Perl Monks concerning the following question:
Example: (please ignore the fact that this code doesn't really do anything, it's meant to illustrate the warning messages only)
Does anyone know why there are different numbers of warnings? (We expect one warning per number that gets thrown away within the list)#!/usr/bin/perl -w use strict; # Why the inconsistency with warning messages? my @movement = (0,1,2,3,4); my $from = ""; if (@movement == (0,1,2)) {$from = "012"} # no warning if (@movement == (1,2,3)) {$from = "123"} # 1 warning if (@movement == (2,3,4)) {$from = "234"} # 2 warnings if (@movement == (3,4,5)) {$from = "345"} # 2 warnings if (@movement == (-0,-1,-2)) {$from = "012"} # 1 warning if (@movement == (-1,-2,-3)) {$from = "123"} # 2 warnings if (@movement == (-2,-3,-4)) {$from = "234"} # 2 warnings if (@movement == (-3,-4,-5)) {$from = "345"} # 2 warnings if (@movement == (0,1,0,1)) {$from = "0101"} # no warning if (@movement == (1,2,1,2)) {$from = "1212"} # 1 warning if (@movement == (2,3,2,3)) {$from = "2323"} # 3 warnings if (@movement == (3,4,3,4)) {$from = "3434"} # 3 warnings
Does this affect anything that I do in my daily coding life? Not likely, I just wanna know 'cause I'm curious.
Sandy
UPDATE
Thanks to all the posters below. It's these little details that make learning stuff all the more interesting.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Warning messages about useless constants ignore '0's and '1's
by Juerd (Abbot) on May 10, 2004 at 23:03 UTC | |
|
Re: Warning messages about useless constants ignore '0's and '1's
by japhy (Canon) on May 10, 2004 at 23:30 UTC | |
by ysth (Canon) on May 11, 2004 at 03:53 UTC | |
|
Re: Warning messages about useless constants ignore '0's and '1's
by ambrus (Abbot) on May 11, 2004 at 16:19 UTC | |
|
Re: Warning messages about useless constants ignore '0's and '1's
by ambrus (Abbot) on May 17, 2004 at 14:27 UTC |