I don't know anything about this format, but CPAN is your friend, there is a module Gedcom that sounds like it will be able to help you.

Note that your Perl source contains some invalid syntax*. Since you say you're just starting with Perl, I suggest starting with perlintro (which includes the tip to Use strict and warnings).

It might be easiest to start with a bit simpler task, like reading the 10th line of a simple text file. <update> Once you get to the section "Files and I/O" of perlintro, you should be able to see what to change in your current script for it to read the lines from the file. </update>

Also, the Basic debugging checklist contains some good tips, like to use Data::Dumper or Data::Dump to look at data structures, which will probably be helpful later on in inspecting the data that the module returns.

We'll be happy to help with any questions you may have while learning. For asking questions, it's always best to include the code you are working on, with things irrelevant to the question removed (although the code should at least still compile, see SSCCE), short sample input data, the expected output for that input, and the actual output you're getting, including any error messages (with line numbers intact). See also How do I post a question effectively?

* Actually, you've since edited your post to fix some of that. Please mark your updates as such, to prevent replies from being confusing - see How do I change/delete my post?

Update: Typo fix: Data::Dumper, not "Date::Dumper", thanks 1nickt!


In reply to Re: How to read a GEDCOM file by haukex
in thread How to read a GEDCOM file by JillB

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.