From: Dave Thomas Date: 2001-01-06T02:19:48+09:00 Subject: [ruby-talk:8697] Re: "the 3 great virtues..." Ruby port Jens Luedicke writes: > That was not my problem... Perl is known for the fact > that you can feed it with even the messiest and ugliest > code. After I had rewritten it with Ruby I tried > to re-style my code like Larry's original... but wasn't > possible. > > #!/usr/bin/perl > > @a=(Lbzjoftt,Inqbujfodf, > Hvcsjt); $b="Lbssz Wbmm" > ;$b =~ y/b-z/a-z/ ; $c = > " Tif ". @a ." hsfbu wj" > "suvft pg b qsphsbnnfs" > ":\n";$c =~y/b-y/a-z/; > print"\n\n$c ";for($i=0; > $i<@a; $i++) { $a[$i] =~ > y/b-y/a-z/;if($a[$i]eq$a > [-1]){print"and $a[$i]." > ;}else{ print"$a[$i], "; > }}print"\n\t\t--$b\n\n"; cc = %w?Tif\ 3\ hsfbu\ wjsuvft\ \ pg\ b\ qsphsbnnfs: Lbzjoftt,\ \ Inqbujfodf,\ aoe\ Hvcsjt.?; b = "Lbssz Wbmm"; b.tr!("b-z", "a-z") cc.each {|i| i.tr!("b-y", "a-z")} puts cc,"\n\n\t\t--\s#{b}","\n\n" See, even all messed up, Ruby code is shorter ;-) Dave