On Apr 28, 2007, at 9:50 PM, Robert Klemme wrote:

> On 28.04.2007 09:06, Robert Dober wrote:
>> On 4/28/07, Robert Dober <robert.dober / gmail.com> wrote:
>>> > love,
>>> > John Joyce
>>> >
>>> >
>>> ARGF.readlines.each_with_index{
>>>    | line, idx |
>>>   puts "%3d %s" % [ idx.succ, line ]
>>> }
>>> HTH
>>> Robert
>> But Robert's solution is nicer, I did not know about ARGF.lineno, and
>> have overlooked his solution, sorry!
>
> :-)  Thank you!  Btw, you can also do ARGF.each_with_index so you  
> do not have to read the whole file into mem before printing it.
>
> Kind regards
>
> 	robert
This .each_with_index seems to be an invaluable method... I'd like to  
know more about it. Can anyone give a little more detail on how  
each_with_index works? The pickaxe covered it too briefly for my  
feeble mind, but clearly it's got legs.