princepawn has asked for the wisdom of the Perl Monks concerning the following question:
The warn at line 20 in my program prints <M> on its last 2 invocations, but not its first... why did this happen. Here is my program:[tbone@horse1 200716-007]$ perl ../delivered-list.pl > delivered-list. +dat UNIX at ../delivered-list.pl line 12. WIN32 at ../delivered-list.pl line 16. IMP_6.rpt at ../delivered-list.pl line 20. Syn5.rpt at ../delivered-list.pl line 20, <M> line 8554. SynOne.rpt at ../delivered-list.pl line 20, <M> line 40689. [tbone@horse1 200716-007]$
use diagnostics; use String::Strip; my @unix_file = 'churn-list.dat'; my @ms_file = <*.rpt>; warn "UNIX"; `cat $_` for (@unix_file); warn "WIN32"; for (@ms_file) { warn $_; proc_ms($_); } sub proc_ms { my $file = shift; open (M, "tail +3 $_ |") or die $!; while (<M>) { last if /^\s*$/; # the line before X rows affected my ($id, $email) = split; StripTSpace($email); print "$id\t$email\n"; } }
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A slight variation in warn output... why?
by mpeppler (Vicar) on Jul 30, 2003 at 17:59 UTC | |
|
Re: A slight variation in warn output... why?
by dreadpiratepeter (Priest) on Jul 30, 2003 at 17:44 UTC | |
by isotope (Deacon) on Jul 30, 2003 at 17:55 UTC |