rubyでのファイル処理

ファイルを開いて一行目を出力

f1=File.open("test.txt","r")
puts f1.readline();

ファイルを開いて全行を出力

f1=File.open("test.txt","r")
f1.each{|str|
puts str;
}