# man > IO::Lines

---
type: CommandReference
command: IO::Lines
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `use IO::Lines` — load the module
- `IO::Lines->new(\@array)` — create a line-oriented array handle
- `$io->print($data)` — print data, automatically breaking at newlines
- `$io->getline()` — read a single line efficiently (each element ends with `\n`)

## Name

`IO::Lines` — IO:: interface for reading/writing an array of lines

## Synopsis

perl
use IO::Lines;
### See IO::ScalarArray for details
## Description

This class implements objects that behave like `FileHandle` (or `IO::Handle`) objects, but operate on an array of lines. It is a subclass of `IO::ScalarArray` where every element of the underlying array ends with `"\n"` (except possibly the final element). This makes `getline()` much more efficient for line-oriented reading/printing.

The `print()` method enforces the line-oriented format: it breaks data at newlines appropriately.

See `IO::ScalarArray` for full usage and warnings.

## Methods

- `print()` — prints data, breaking at newlines to maintain line-oriented array
- `getline()` — reads a single line; more efficient in line-oriented mode
- `getlines()` — reads all remaining lines (thanks to Morris M. Siegel)
- `tiehandle` — supports tiehandle interface

## See Also

- [`IO::ScalarArray`](https://perldoc.perl.org/IO::ScalarArray) — base class with full documentation
- [`IO::Handle`](https://perldoc.perl.org/IO::Handle) — base handle class