Talk:Read a specific line from a file: Difference between revisions

added comment about sparse files. ~~~~
m (Demote a section header.)
(added comment about sparse files. ~~~~)
Line 5:
::Looking again, I guess that the Perl6 solution is missing some file opening code, and closing code and is capturing to standard output. It probably just requires a small change. I have not got round to looking at Perl6 yet, so I am not skilled enough to make such changes at this time.[[User:Markhobley|Markhobley]] 01:06, 24 July 2011 (UTC)
:::I guess my point is that assuming there's a variable assumes you're using an imperative language. Perl 6 is more of a functional language, and lines (without other arguments) returns a lazy list of the lines from the file named on the command line, or STDIN, much like <tt><></tt> does in Perl 5. The open and close are implicit in the generator. The <tt>[6]</tt> subscript selects the 7th element of the lazy list and returns it. Then we print that. Storing it in a variable would be an unnecessary step, and rather unidiomatic, and not needed for the main point of the task. --[[User:TimToady|TimToady]] 01:44, 24 July 2011 (UTC)
 
 
==sparse files==
Some operating systems allow sparse files, that is, a file may have (say) the 1st, 2nd, 500th, and the one millionth record defined (four actual records), but it appears that there are one million records in the file, and almost all of them null (empty). [[User:Gerard Schildberger|Gerard Schildberger]] 04:04, 14 March 2012 (UTC)