rovf has asked for the wisdom of the Perl Monks concerning the following question:
Here is an excerpt of my code:
I expected to see the first line of my file printed, and the number of lines in the file, but the first print statement prints the whole file, and the second print statement says Number of lines in file: 0. I guess I have misunderstood something in the description of Tie::File. What did I do wrong?use Tie::File; .... my @content; tie @content, 'Tie::File', $filename or die "Can not read file $file +name ($!)"; print "First Line: $content[0]\n"; print "Number of lines in file: $#content\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't get Tie::File working
by JavaFan (Canon) on Oct 14, 2008 at 11:47 UTC | |
by rovf (Priest) on Oct 14, 2008 at 12:32 UTC | |
|
Re: Can't get Tie::File working
by lamp (Chaplain) on Oct 14, 2008 at 11:36 UTC | |
by rovf (Priest) on Oct 14, 2008 at 11:41 UTC | |
by Corion (Patriarch) on Oct 14, 2008 at 11:45 UTC | |
by rovf (Priest) on Oct 14, 2008 at 12:10 UTC | |
by Corion (Patriarch) on Oct 14, 2008 at 12:29 UTC |