steph_bow has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, I am working with my Perl program on csv files. These csv files contained some information lines, gathered in blocks.
RWY_protection_1;80 -0.701399;44.840355 -0.698625;44.838375 -0.728149;44.817631 -0.730969;44.819683 -0.701399;44.840355 RWY_protection_2;80 -0.696316;44.826075 -0.697434;44.823624 -0.731108;44.830796 -0.730151;44.833011 -0.696316;44.826075 Restricted_area_protection_localizer_1;80 -0.734401;44.816223 -0.732972;44.815214 -0.734348;44.814279 -0.735763;44.815288 -0.734401;44.816223
Everything was OK until I made some modifications in my files and then there was some ";" instead of the blank lines. Thus my code did not work.
I don't know how to modify it so that even if some ";" appear (several per line), it will still work.
Here is a part of my code
while(my $line = <$FILE>){ $line =~ s/\s+$//; if ($line =~ /(^\w+)/){ ... } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: skip blank lines that may contain from time to time some ";"
by ikegami (Patriarch) on Jun 01, 2009 at 17:04 UTC | |
|
Re: skip blank lines that may contain from time to time some ";"
by almut (Canon) on Jun 01, 2009 at 17:04 UTC | |
|
Re: skip blank lines that may contain from time to time some ";"
by John M. Dlugosz (Monsignor) on Jun 01, 2009 at 19:44 UTC | |
|
Re: skip blank lines that may contain from time to time some ";"
by perliff (Monk) on Jun 02, 2009 at 09:55 UTC |