わたなべです. OZAWA Sakuro <crouton / po.shiojiri.ne.jp> writes: :RubyってPerlに比べるとコードが縦に長くなるような気がします. たしかに. でも Perl の script を Ruby に移植すると短くなるよ うな気もする. :「Just Another Ruby Hackerスクリプトの例」なんてのをRuby本の章末コラム :として散らすのはどうでしょう? 章が進むごとにだんだん奇怪・難解になっ :ていくの:) んじゃ, とりあえず. 先頭に ; がついてないのがたぶん未発表. #実はそれほど凝ってない. # # Just another ruby hacker, # # $Id: jarh,v 0.1 1998/02/18 04:39:03 watanabe Exp watanabe $ print %%Just another ruby hacker,% ;print ",rekcah ybur rehtona tsuJ".reverse ;print %q/92G5S="!A;F]T:&5R(')U8GD@:&%C:V5R+```/.unpack('u') print %q/SnVzdCBhbm90aGVyIHJ1YnkgaGFja2VyLA==/.unpack('m') ;print 'Whfg nabgure ehol unpxre,'.tr('A-Za-z', 'N-ZA-Mn-za-m') ;[2,14,12,13,0,3,9,10,13,7,6,11,0,11,14,4,15,0,7,3,5,8,6,11,1].each do |i| ; print ' ,Jabcehknorstuy'[i, 1] ;end print [ 74, 117, 115, 116, 32, 97, 110, 111, 116, 104, 101, 114, 32, 114, 117, 98, 121, 32, 104, 97, 99, 107, 101, 114, 44 ].pack('c*') print({'ruby' => 'Just another ruby hacker,'}['ruby']) print 'jUsT aNoThEr RuBy HaCkEr,'.capitalize print ['Just another ruby hacker,'][0] print ['hacker,', 'ruby ', 'another ', 'Just '].reverse proc {print 'Just another ruby hacker,'}.call def pri; print 'Just another ruby hacker,'; end; pri for i in 'Just another ruby hacker,'; print i; end print `echo -n Just another ruby hacker,` print 'Just another ruby hacker,'.split('').join print 'JQust aQnotQher rQuby hQackQer,'.delete('Q') 'Just another ruby hacker,'.scan(/(.)/) {print $1} print 'Just ' + 'another ' + 'ruby ' + 'hacker,' print ['4a75737420616e6f746865722072756279206861636b65722c'].pack('H*') print 'Just another ruby hacker,'.split(/(.)/) print %w(Just another ruby hacker,).join ' ' print({"another "=>"Just ", "hacker,"=>"ruby "}.invert.reverse.join) $stdout << <<'<<' Just another ruby hacker, <<