in reply to Cross platform file I/O code

This is a non-problem. While you can set $/, normally when reading or writing text files your "\n" will transparently become what it needs to be for your OS. Therefore printing "\n" to a file will (by default) do something reasonable.

If you wish to change this, use binmode. But unless you are using binmode or reading the same files on multiple operating systems at once, you don't need to worry about what the record separator is.

Or put another way, the following script is portable:

#! /usr/bin/perl -w use strict; print "Hello, world\n";