Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ruby¶¼´ÓPerlÄǼ̳ÐÁËʲô£¿


×î½ü¿´ÁË¿´Perl£¬Ö÷ÒªÊÇÏë¿´¿´Ruby¶¼´ÓPerlÄÇÄÃÀ´ÁËЩʲô¡£Í¬Ê±£¬Ò²ÊÇÎÒѧϰPerlµÄһƪ±Ê¼Ç¡£
Ϊʲô´ó¼Ò¶¼ÊÇPerlµÄ´úÂë³óª£¬ÊÇʲôµ¼ÖÂÁËPerl³ÌÐò»ÞɬÄѶ®£¬RubyÖÐÓÖÊÇÈçºÎÈ¡ÉáÕâЩԪËصÄÄØ£¿ÎÒÈÏΪPerlÉçÇø×·Çó¸üÉÙ´úÂëµÄ·çÆøÖú³¤ÁË´óÁ¿Ê¹ÓÃÔ¤Éè±äÁ¿µÄ·çÆø£¬´Ó¶øµ¼ÖÂÁËPerl´úÂëµÄ»Þɬ¡£
ÏÂÃæµÄÿ¸öPerlµÄÀý×Ó×Ü°éÓÐRubyµÄ¶ÔÕÕ¡£
PerlµÄÀíÄî-ÌõÌõ´óµÀͨÂÞÂí¡¸There is more than one way to do it¡¹¡£
¶¼ËµPerl¼òµ¥¡¢“ÍòÄÜ”¡¢¿ìËÙ¡¢³óª£¬RubyÕ¦¾ÍÕâôÂýÄØ£¿
PerlµÄÇ°ÉíÓïÑÔ£ºC, awk, sed, sh, ÒÔϵͳ¹ÜÀíΪĿ±ê, Ç¿µ÷ʹÓÃÐÔ¶ø²»ÊÇÃÀ¹Û¡£
¶Ï¾ä
PerlµÄÓï¾äÊÇÒÔ·ÖºÅ";"×÷Ϊ·Ö¸ô£¬¶øRubyÊÇÒÔ»»ÐС£ËùÒÔRubyµÄ´úÂëÖÐÏʼû·ÖºÅ¡£
ÊäÈëÊä³ö
RubyµÄÊä³ö(print)Ëƺõ¾ÍÊÇ´ÓPerlÄÇÖ±½ÓÄùýÀ´µÄ£º
#!perl
print "hi, Pope." 
#!ruby
print "hi, Pope." 
µ«×Ö·û´®µÄÄÚ²å¾ÍÓÐËù²»Í¬ÁË¡£
PerlÖпÉÒÔÕâÑùʵÏÖ×Ö·û´®µÄ±äÁ¿Ìæ»»£º
#!perl
my $name = "Pope";
print "hi, $name\n"; 
¶øRubyÖÐÊǽ«±äÁ¿ÓÃ#{}°ü¹üÆðÀ´£º
#!ruby
name = "Pope"
print "hi, #{name}." 
PerlµÄÊäÈëʹÓÃ<STDIN>¡£²»¹ý£¬´ó¼ÒÒ»°ãÓÃ×êʯÔËËã·û(diamond operator)"<>":
#!perl
print "please enter your name:";
my $name = <>;
print "hello, $name\n"; 
ÔÚRubyÖУ¬Ò»°ãÓÃSTDIN.gets»òÕßgets£º
#!ruby
print "please enter your name:";
name = gets;
print "hello, #{name}\n"; 
×Ö·û´®
PerlµÄ×Ö·û´®¿ÉÒÔÓÃË«ÒýºÅÀ¨ÆðÀ´,Ò²¿ÉÒÔÓÃqq//,qq||,qq{},qqºó¸úÈÎÒâ³É¶ÔµÄ·ûºÅ.
#!perl
my $s1 = "Pope";
my $s2 = qq/Pope/;
my $s3 = qq|Pope|;
my $s4 = qq{Pope}; 
RubyҲѧÀ´ÁË,ÓÃ%q»ò%Q¼ÓÈÎÒâ³É¶ÔµÄ·ûºÅ.²»¹ý,Rubyistϲ»¶ÓÃ%q[].(¸½´ø˵Ã÷Ò»ÏÂ%qºÍ%QµÄÇø±ð,ÓÃ%qÀ´À¨¾ÍºÃÏóÊÇÓõ¥ÒýºÅ,¶ø%QÈçͬ˫ÒýºÅ.µ¥Ë«ÒýºÅÊDz»Í¬µÄà¸!)
#!ruby
s1 = "Pope";
s2 = %Q/Pope/;
s3 = %Q|Pope|;
s4 = %Q{Pope}; 
Êý×é
ÔÚPerlÖУ¬Êý×é±äÁ¿ÊÇÒÔ@·û¿ªÍ·,ÓÃСÀ¨ºÅ°ÑÖµÀ¨ÆðÀ´.
#!perl
my @array = (1, 2, 3); 
ÓÃqwÒ²ÐÐ:
#!perl
my @array = qw/1 2 3/; 
RubyÖÐÊÇÓÃÖÐÀ¨ºÅ£¬Ò²¿ÉÓÃ%w¡£
#!ruby
array = [1, 2, 3] 
PerlºÍRubyµÄÊý×鶼¿ÉÒÔ×Ô¶¯À©³ä¡£Êý×éÖÐûÓÐÖ¸¶¨ÖµµÄÔªËػᱻPerlÉèΪundef£¬¶øRubyÖÐÊÇnil¡£ÔÚPerlÖмÆËãÊý×鳤¶ÈÊÇÓÃ$#array+1£¬ÆäÖÐ$#arrayÊÇÊý×éarrayµ


Ïà¹ØÎĵµ£º

Cassandra in Action with Twitter's Ruby Client

ÓÐÒ»¸öȫеÄÏîÄ¿£¬ÒòΪ¿¼Âǵ½½«À´µÄÊý¾ÝÀ©Õ¹ÐÔÄÜ£¬ËùÒÔ¿¼ÂÇÓÃCassandra×öÊý¾Ý´æ´¢£¬Ç°¶ËÓÃLighttpd + FastCGI + Rails¡£ÔÚʹÓÃCassandraµÄʱºò£¬¾õµÃÓÐһЩ¶«Î÷¿ÉÄÜ´ó¼Ò¶¼ÐèÒª£¬¾ÍдÁËÒ»¸ö¼òµ¥µÄÖ¸ÄÏ¡£ÒòΪÄÚÈݱȽϳ¤£¨16Ò³£©£¬¾ÍŪÁ˸öPDFÎļþ¸ø´ó¼ÒÏÂÔØ¡£
Cassandra in Action with Twitter's Ruby Client.pdf
Èç¹ûÏÂÔ ......

¼Ç¼ÏÂ×Ô¼ºUbunt 10.04 ´î½¨ruby on rails»·¾³

1¡¢°²×°ubuntu
һ·next£¬¼Çס°²×°Ó¢ÎÄ°æ¡£´ý°²×°Íê±Ïºó£¬Ê×ÏÈÑ¡Ôñ“Èí¼þÔ´”£¬ÏµÍ³--ϵͳ¹ÜÀí-Èí¼þÔ´£¬¹úÄÚÒ»°ãÑ¡ÔñµÄÊÇ£ºhttp://ubuntu.cn99.com/ubuntu;½Ó×Å°²×°ÖÐÎÄ°ü£¬Ñ¡ÔñÈí¼þÔ´¾ÍÊÇΪÁËÏÂÔØÈí¼þµÄËٶȸü¿ì£¬°²×°Íê³ÉºóÖØÆôubuntu£¬ÖØÆôºó»áÌáʾÊÇ·ñ¸Ä±äijЩÎļþ¼ÐÃû³Æ£¬Ñ¡Ôñ“·ñ”£¬·Àֹϵͳ¶Ô ......

RubyÓïÑÔѧϰϵÁÐ »ù±¾µÄrubyÓï·¨


RubyÓïÑÔѧϰϵÁÐ--»ù±¾µÄrubyÓï·¨
 
1.     »ù±¾µÄrubyÓï·¨
1.1      ±äÁ¿¡¢³£Á¿ºÍÀàÐÍ
1)      ¶¨Òå±äÁ¿
±äÁ¿ÀàÐÍ
ÃèÊö
ʾÀý
¾Ö²¿±äÁ¿£¨»òα±äÁ¿£©
ÒÔСд×Öĸ»òÏ»®Ïß¿¨Í·
var    _var
È«¾Ö±äÁ¿
ÒÔ$¿ªÍ·
$ ......

ruby gem mysql on cygwin

1£®    °²×°Cygwin
ÔËÐÐCygwinµÄ°²×°³ÌÐò¡£´ÓÎļû°üµÄµÄÁбíÖУ¬ÔÚDEVÀïÃ棬ȷ¶¨ÒªÑ¡Ôñ
• Ruby
• gcc
• subversion
    ÄãÐèҪʹÓÃgccÀ´½¨Á¢Cygwin°æ±¾µÄMySQL.
2. ÔÚwindowsÉÏÃæ°²×°MYSQL£º
    download MySQL 5.0 Windows Installer
3£®  & ......

rubyѧϰ±Ê¼Ç

1. ½øÖƵĿì½Ýת»»
"100".to_i(2) , ½«100×÷Ϊ¶þ½øÖÆÊä³öÊ®½øÖÆÊý£¬
½á¹û £º 4
"100".to_i(9), ¾Å½øÖÆ£¬
½á¹û£º 81
"100".to_i(16), Ê®Áù»úÖÆ£¬
½á¹û£º 256
±È½Ï˧£¬×Ö·û´®×ª»»ÔÚvc±à³ÌÀïÃæ±È½ÏÍ·ÌÛ¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ