Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Read one line from a file

use strict;
use warnings;

# Reading a line from a file (or rather from a filehandle)
my $filename = "input.txt";
if (open my $data, "<", $filename) {
    my $line = <$data>;
    print $line;

} else {
    warn "Could not open file '$filename': $!";
}