Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Read a File with any Line Ending (See related posts)

Here is a quick way in Perl to read lines from a file regardless of whether it is Unix, Mac, or DOS.

my @lines = split(/\012\015?|\015\012?/,(join '',<FILE>));

You need to create an account or log in to post comments to this site.


Click here to browse all 4861 code snippets

Related Posts