Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Could one of the esteemed monks who delves into arcane behaviour please assist me.
I have a snippet of code:
print STDERR "$rec->[IMP_WG] $rec->[CSC_HAN]\n"; if ( defined( $rec->[IMP_WG] ) && $rec->[IMP_WG] ne '' && defined( $rec->[CSC_HAN] ) && $rec->[CSC_HAN] eq '1' ) { print "$rec->[CLASSIF] $rec->[IMP_WG] $rec->[SRV_PLT]\n"; }
That produces (in part) the following output (greenfox you can look away now):
CSC.MIDRANGE.SERVER.SUPPORT 1 CSC.MIDRANGE.SERVER.SUPPORT 1 CSC.MIDRANGE.SERVER.SUPPORT 1 Use of uninitialized value at stats2 line 190. CSC.NETWORK.ENG 1 Use of uninitialized value at stats2 line 190. 0 CSC.MIDRANGE.SERVER.SUPPORT 1 Use of uninitialized value at stats2 line 190. 0 CSC.NT.SERVER.SUPPORT 1 Use of uninitialized value at stats2 line 190.
Line 190 is the 'if' statement in the listed code.
The input data is the result of a split operation and it is possible that the indexes IMP_WG and CSC_HAN could contain undef values.
This is perl, version 5.005_03 built for sun4-solaris.
use strict; and -w are in use.
Any suggestions about what I am missing?
20040108 Edit by jeffa: Changed title from 'I dont understand why Perl is complaining.'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split, Use of uninitialized value
by pg (Canon) on Jan 07, 2004 at 03:56 UTC | |
|
Re: split, Use of uninitialized value
by Roger (Parson) on Jan 07, 2004 at 03:26 UTC | |
by pg (Canon) on Jan 07, 2004 at 03:49 UTC | |
by Anonymous Monk on Jan 07, 2004 at 03:54 UTC | |
by Roger (Parson) on Jan 07, 2004 at 04:02 UTC | |
by Anonymous Monk on Jan 07, 2004 at 04:12 UTC | |
by Roger (Parson) on Jan 07, 2004 at 04:34 UTC | |
| |
|
Re: split, Use of uninitialized value
by Tommy (Chaplain) on Jan 07, 2004 at 03:24 UTC | |
by Roger (Parson) on Jan 07, 2004 at 03:42 UTC | |
by Tommy (Chaplain) on Jan 07, 2004 at 22:52 UTC | |
|
Re: split, Use of uninitialized value
by ysth (Canon) on Jan 07, 2004 at 04:35 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |