Code Snippets

Tag: Io

Read a File into a String

Slurp an entire file into a string with File.read, the idiomatic Ruby way.

Author: chris

Write Lines to a File in Perl

Open a file for writing and emit several lines, then close cleanly.

Author: chris

Read a File Line by Line in Perl

Open a filehandle and iterate over a text file one line at a time, chomping trailing newlines.

Author: chris