in reply to How to read a GEDCOM file
That should probably solve your problem and make your script work. I would suggest, however, that you rewrite the script in accordance with commonly accepted best practices. For example as follows:@MyGed = <MYFILE>;
#!/usr/bin/perl use strict; use warnings; my $file_in = "C:/Users/Jill/Documents/Genealogy/birdt.ged"; open my $FILE, "<", $file_in or die "could not open $file_in $!"; # t +hree-argument open syntax my @ged = <$FILE>; # s +lurp the file contents into @ged my $count = $.; # or, as you had it: my $count = @ged; print "10th record : $ged[10]\n"; # n +ote that $ged[10] is really the 11th record (array subscripts start a +t 0) print "No. of records : $count \n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to read a GEDCOM file
by JillB (Novice) on Nov 19, 2017 at 19:47 UTC | |
by AnomalousMonk (Archbishop) on Nov 19, 2017 at 20:39 UTC |