I am rewriting a Perl program in Ruby to see the difference.
Follows is a segment of the Perl program:
while (<>) {
if (/1999/) {
($date, $hour, $name, $id) = split;
print "$date:$hour:$name:$id\n"
}
}
And follows is the counterpart in Ruby:
while(gets())
if /1999/
date, hour, name, id = split
print "#{date}:#{hour}:#{name}:#{id}\n"
end
end
I am not sure which one, Perl or Ruby, is more readable here. This is a
curious observation: to get rid of the $ on one line, one has to pay #{} on
the following line. Is this the principle "pay it now, or pay it later ...
with interest!" ?
Dat
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com