From: Randy Kramer Date: 2006-03-27T05:55:30+09:00 Subject: Ruby-esque approaches to adding a line at the beginning of a file. On our local lug mail list a discussion came up about using Ruby (as opposed to Perl) for an application that involved inserting a new line at the front of an existing file. (As a newbie), I proposed an approach like this (with help from the Ruby Cookbook which I'm working my way through). t = "New first line of file.\n" t = t + open("sample_file") { |f| f.read } open("sample_file", "w") { |f| f.write(t)} However, it doesn't appear (to me) to be very Ruby-esque--I'm wondering how others on this list might approach such a task. Randy Kramer