jjap has asked for the wisdom of the Perl Monks concerning the following question:
Yields the 10 correct values followed by 5 warnings such as:use warnings; use strict; my $line; my $msgtype; my $bytes34 ; while (<DATA>) { chomp; next if ($_ =~ /^$/); # fixes the issue... $line = $_; $msgtype = substr $line, 6, 8; # keep only relevant type next if ( $msgtype ne "18FEF200") ; $bytes34 = substr $line, 26, 2; print "Line is: $line\n"; print "qty is: $bytes34\n"; } __END__ 0 18FEF200 X 8 00 00 FF FF 00 00 FF FF 17487.23877 +0 0 18FEF200 X 8 00 00 FF FF 00 00 FF FF 17487.13877 +0 0 18FEF200 X 8 0F 00 00 00 00 00 FF FF 17484.93861 +0 0 18FEF200 X 8 12 00 00 00 00 00 FF FF 17484.83858 +0 0 18FEF200 X 8 00 00 FF FF 00 00 FF FF 17486.83875 +0 0 18FEF600 X 8 FF 31 72 FF FF FF FF FF 17486.75931 +0 0 18FEF200 X 8 1E 01 00 00 00 00 FF FF 17321.32261 +0 0 18FEF200 X 8 2E 01 00 00 00 00 FF FF 17321.22202 +0 0 18FEF200 X 8 45 01 00 00 00 00 FF FF 17321.12260 +0 0 18FEF200 X 8 5A 02 00 00 00 00 FF FF 17016.19730 +0 0 18FEF200 X 8 75 02 00 00 00 00 FF FF 17016.09727 +0
Your indulgence and any hints will be greatly appreciated!substr outside of string at parsefile.pl line 13, <DATA> line 12. Use of uninitialized value $msgtype in string ne at parsefile.pl line +16, <DATA> line 12.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Are these warnings indicative of a problem with the structure? (Baby Perl, easy xp... ;-)
by AR (Friar) on Oct 27, 2010 at 21:14 UTC | |
by jjap (Monk) on Oct 27, 2010 at 21:18 UTC | |
|
Re: Are these warnings indicative of a problem with the structure? (Baby Perl, easy xp... ;-)
by aquarium (Curate) on Oct 27, 2010 at 22:04 UTC |