R
Rainer Weikusat
Right now, I'm dealing with (two) single line files whose single line
contains data in the form of
YYYYMMDD XXXX
the first being a date and the second a counter. So far, I've been using
a pretty conventional
$rc = <$fh>;
chomp($rc);
($date, $counter) = split(/\s+/, $rc);
for getting the data out of the file. While working with this code in
order to add some features to it, it came to me that
($date, $counter) = split for <$fh>
works as well, as does
($date, $counter) = map { split } <$fh>;
but I like the first one better. Comments or alternate suggestions?
contains data in the form of
YYYYMMDD XXXX
the first being a date and the second a counter. So far, I've been using
a pretty conventional
$rc = <$fh>;
chomp($rc);
($date, $counter) = split(/\s+/, $rc);
for getting the data out of the file. While working with this code in
order to add some features to it, it came to me that
($date, $counter) = split for <$fh>
works as well, as does
($date, $counter) = map { split } <$fh>;
but I like the first one better. Comments or alternate suggestions?