#Add the header lines. Note extra undef for extra newline unshift @playlist, ("PLP PLAYLIST", "VERSION 1.20", undef); #Cheapo packing into two bytes s/(.)/\1\x{00}/gc for @playlist; #Explicit newlines added $playlist = join "\x{0D}\x{00}\x{0A}\x{00}", @playlist; open PLAYLIST, ">", 'playlist.plp' or die "Couldn't open playlist.plp: $!"; #Hey perl, no funny stuff binmode PLAYLIST; $\ = undef; print PLAYLIST $playlist;