Perl to output processed XML file encoded as UTF-8 with UNIX line endings (in Win32 environment)?
- by Umber Ferrule
Running ActiveState Perl 5.8.8 on WinXP.
As the title suggests, 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);
}
Any suggestions? Thanks.