>From: Yasushi Shoji <yashi / yashi.com> >Reply-To: ruby-talk / netlab.co.jp >To: ruby-talk / netlab.co.jp (ruby-talk ML) >Subject: [ruby-talk:03653] Re: Perl and Ruby: an Irony >Date: Sat, 24 Jun 2000 19:30:51 -0400 > >From: "Dat Nguyen" <thucdat / hotmail.com> >Subject: [ruby-talk:03645] Perl and Ruby: an Irony >Date: Sat, 24 Jun 2000 02:47:47 EDT > > > 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!" ? > >just my two cents >you don't have to use '#{}' for each variables. >-- > yashi > >$<.each do |l| > if /1999/ =~ l > print "#{l.split.join(':')}\n" > end >end > The trouble is sometimes I have to fish some fields in the middle of the lines, and reorder the fields to be displayed or written to a file. For instance: service, ignore, name, age, ignore, salary = split print "#{name}\t#{age}\t#{salary}\t#{service}\n" Another point is I use the variable names to document the code. Maintainers would not have to guess what i am splitting and joining. Dat ________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com