can you give a bit hint, especially the # at the end, :-)!
  1. my @headers = split ' ', do{ my $raw = <DATA>; $raw =~ tr[",][ ]; $raw }; #"
    • Read the header line into $raw;
    • Get rid of the quotes and commas and replace with spaces;
    • return the modified line to split and split on whitespace;
    • The #" at the end is just a comment; it balances up the earlier ", and prevents it from screwing up the syntax highlighting in my editor.
  2. $line =~ tr[",][ ]; #"

    Same as above. (Though it was wrong for the rest of the lines, a C&P error correct below.)

  3. push @{ $planes{ $aid } }, \%row;

    push a reference to the hash constructed from teh most recent line into the array indexed by the aircraft id.

  4. next unless @{ $planes{ $aid } } > 1;

    If we don't have 2 or more lines (in the array) for this aircraft, we cannot calculate a bearing yet, so skip to the next line.

A couple of corrections and a couple of tweaks:

With the extended dataset (still no course changes!), produces:

C:\test>junk53 Aircraft: 685 heading: -90.000 Aircraft: 721 heading: 0.000 Aircraft: 704 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 709 heading: 0.000 Aircraft: 721 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 709 heading: 90.000 Aircraft: 704 heading: 0.000 Aircraft: 721 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 704 heading: 0.000 Aircraft: 709 heading: 90.000 Aircraft: 721 heading: 0.000 Aircraft: 709 heading: 0.000 Aircraft: 704 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 721 heading: 0.000 Aircraft: 709 heading: 90.000 Aircraft: 704 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 721 heading: 0.000 Aircraft: 709 heading: 90.000 Aircraft: 685 heading: -90.000 Aircraft: 704 heading: 0.000 Aircraft: 721 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 704 heading: 0.000 Aircraft: 709 heading: 90.000 Aircraft: 721 heading: 0.000 Aircraft: 709 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 704 heading: 0.000 Aircraft: 721 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 704 heading: 0.000 Aircraft: 709 heading: 90.000 Aircraft: 721 heading: 0.000 Aircraft: 704 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 709 heading: 90.000 Aircraft: 721 heading: 0.000 Aircraft: 704 heading: 0.000 Aircraft: 685 heading: -90.000 Aircraft: 709 heading: 0.000 Aircraft: 721 heading: 0.000 Aircraft: 709 heading: 90.000 Aircraft: 685 heading: -90.000

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^5: Calculate aircraft headings from GPS data for google kml display by BrowserUk
in thread Calculate aircraft headings from GPS data for google kml display by hujunsimon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.