NAME

File::LoadLines - Load lines from file

SYNOPSIS

use File::LoadLines;

my @lines = loadlines("mydata.txt");
...

DESCRIPTION

File::LoadLines provides an easy way to load the contents of a text file into an array of lines.

It automatically handles ASCII, Latin and UTF-8 text. When the file has a BOM, it handles UTF-8, UTF-16 LE and BE, and UTF-32 LE and BE.

Recognized line terminators are NL (Unix, Linux), CRLF (DOS, Windows) and CR (Mac)

EXPORT

loadlines

FUNCTIONS

loadlines

my @lines = loadlines("mydata.txt");
my @lines = loadlines("mydata.txt", $options);

Basically, the file is opened, read, decoded and split into lines that are returned in the result array. Line terminators are removed.

In scalar context, returns an array reference.

The first argument may be the name of a file, and opened file handle, or a reference to a string that contains the data.

The second argument can be used to influence the behaviour. It is a hash reference of option settings.

split

Enabled by default.

If set to zero, the data is not split into lines but returned as a single string.

chomp

Enabled by default.

If set to zero, the line terminators are not removed from the resultant lines.

AUTHOR

Johan Vromans, <JV at cpan.org>

SUPPORT AND DOCUMENTATION

Development of this module takes place on GitHub: https://github.com/sciurius/perl-File-LoadLines.

You can find documentation for this module with the perldoc command.

perldoc File::LoadLines

Please report any bugs or feature requests using the issue tracker on GitHub.

COPYRIGHT & LICENSE

Copyright 2018 Johan Vromans, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.