I'm running ActivePerl 5.8.8 on WinXP. I'd like to output an XML file as UTF-8 with UNIX line endings.
I've looked at the perldoc for binmode
, but am unsure of the exact syntax (if I'm not barking up the wrong tree). The following doesn't do it (forgive my Perl - it's a learning process!):
sub SaveFile
{
my($FileName, $Contents) = @_;
my $File = "SAVE";
unless( open($File, ">:utf-8 :unix", $FileName) )
{
die("Cannot open $FileName");
}
print $File @$Contents;
close($File);
}