It's been a couple of months since I was Perling, but I'm completely fixated on why this is happening ...
I'm on OSX if that matters.
I am trying to convert strings to a file like
03/08/2011 01:00 PDT, 1.11
to stdout lines like
XXX, 20120803, 0100, KWH, 0.2809, A, YYY
Since I am reading a file, I want chompafter reading each line. However, when I chomp, I find that my seal is all messed up. When I'm not chomp, printing is fine (except for the extra line of a new line ...). What's going on here?
while(<SOURCE>) {
chomp;
my @tokens = split(' |,');
my $converted_date = convertDate($tokens[0]);
my $converted_time = convertTime($tokens[1]);
print<<EOF;
$XXX, $converted_date, $converted_time, KWH, $tokens[3], A, YYY
EOF
}
With an incoming call, the chompoutput is all mixed up:
, A, YYY10803, 0100, KWH, 1.11
Without calling chompthere, it at least prints in the correct order, but with an additional new line:
XXX, 20110803, 0100, KWH, 1.11
, A, YYY
, chomp "" . autoflush $|=1;, , .
? ....