Read a specific line from a file: Difference between revisions

Added Haskell implementation
m (→‎{{header|REXX}}: indented a SELECT group, made comment box easier to read. -- ~~~~)
(Added Haskell implementation)
Line 356:
}
println "Line 7 = $line"</lang>
 
=={{header|Haskell}}==
 
<lang Haskell>main :: IO ()
main = do contents <- readFile filename
case drop 6 $ lines contents of
[] -> error "File has less than seven lines"
l:_ -> putStrLn l
where filename = "testfile"</lang>
 
=={{header|Icon}} and {{header|Unicon}}==
Anonymous user