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+)/){
...
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.