8.3 比對

文章推薦指數: 80 %
投票人數:10人

表示比對不符合$& 代表最後一次成功比對的字串$` 代表比對到的字串之前半段所有字串$' 代表比對到的字串之後半段 ... if ($my_best_like =~ /Perl/) { print "Bingo! ºô¸ôºÞ²z»y¨¥Perl¤Jªù»P¹ê§@:<<>>8.3¤ñ¹ï¤ñ¹ïªº»yªk¦p¤U¡A­Y¤ñ¹ï¦¨¥\«h¶Ç¦^¯u¡A¤£¦¨¥\«h¶Ç¦^°²¡C m/¼Ë¦¡/ ¥i²¼g¦¨/¼Ë¦¡/ ¨ä¤¤/¥i´«¦¨¨ä¥¦²Å¸¹¡A¦ý¦¹®É¤£¯à±Nm¦r¤¸Â²±¼¡A¦p¡G m!¼Ë¦¡! m#¼Ë¦¡# ¥i¥[¤W­×¹¢¤l¡Gimosxg ¥Îªk¡G/¼Ë¦¡/­×¹¢¤l i¤£­p¤j¤p¼g mµø¦r¦ê¬°¦h¦C o¥u½sĶ¤@¦¸¡A¥H¥[§Ö°j°é³B²z³t«× s·í§t¦³´«¦C²Å¸¹®É¡A¤´µø¬°¤@¦C x¤¹³\§t¦³µù¸Ñ¡A¨Ã©¿²¤ªÅ¥Õ g¥þ°ì¤ñ¹ï =~ªí¥Ü¤ñ¹ï²Å¦X !~ªí¥Ü¤ñ¹ï¤£²Å¦X $&¥Nªí³Ì«á¤@¦¸¦¨¥\¤ñ¹ïªº¦r¦ê $`¥Nªí¤ñ¹ï¨ìªº¦r¦ê¤§«e¥b¬q©Ò¦³¦r¦ê $'¥Nªí¤ñ¹ï¨ìªº¦r¦ê¤§«á¥b¬q©Ò¦³¦r¦ê ¥Î¨Ò1¡G if($my_best_like=~/Perl/){ print"Bingo!!!\n"; }else{ print'$%#@#$&*%$#@!',"\n"; } ­Y¤£·Q°Ï¤À¤j¤p¼g¡A¥i¥[¤W­×¹¢¤li¡G if($my_best_like=~/Perl/i){ print"Bingo!!!\n"; }else{ print'$%#@#$&*%$#@!',"\n"; } ­Y·Q¥þ­±¤ñ¹ï¨C¤@­Ó¦a¤è¡A¥i¥[¤W­×¹¢¤lg¡G $_="IwanttogotoSanFrancico.Iwantto!"; @word=/want/g;#¶Ç¦^¤ñ¹ï¨ìªº¦r¦ê print"@word\n"; ¿é¥X¡G wantwant µù¡G$_¬°m//¹w³]§@¥Î¹ï¶H¡C¥Î¨Ò2¡G chomp($IP=); if($IP=~/\d+\.\d+\.\d+\.\d+/){ print"$IP¥i¯à¬O¦XªkªºIP¦ì§}!\n"; }¥Î¨Ò3¡G±N¤ñ¹ï¦¨¥\ªº¼Ë¦¡°O¾Ð°_¨Ó!!!(­«­n¥\¯à) chomp($IP=); if($IP=~/(\d+)\.(\d+)\.(\d+)\.(\d+)/){ print"²Ä¤@­Óip¡G$1\n"; print"²Ä¤G­Óip¡G$2\n"; print"²Ä¤T­Óip¡G$3\n"; print"²Ä¥|­Óip¡G$4\n"; }¥Î¨Ò4¡G¼Ë¦¡¤¤¥i¥H¶i¦æÅܼƥN´« $msg_start='^From\s.*?@?.*?\s+?\w+\s\w+\s\d+\s\d+:\d+:\d+\s\d+'; if($line=~/$msg_start/){ print"¤@«Ê«H¥óªº¶}©l!\n"; } ¥Î¨Ò5¡G¼Ë¦¡¤£²Å¦X¡A¨Ï¥Î!~²Å¸¹ $msg_start='^From\s.*?@?.*?\s+?\w+\s\w+\s\d+\s\d+:\d+:\d+\s\d+'; #$line­Y¤£²Å¦X$msg_start³o­Ó¼Ë¦¡ if($line!~/$msg_start/){ print"¤£¬O¤@«Ê«H¥óªº¶}©l!\n"; } ¥Î¨Ò6¡G©MÀÉ®×°t¦X while(){ printif/Kill/i; } __DATA__ Killyou,killme. Someonekill yesdoit Justmake. Marrykilledbymoney. ¥Î¨Ò7¡G|ªº¹B¥Î while(){ printif/Kill|Someone|Just/; } __DATA__ Killyou,killme. Someonekill yesdoit Justmake. Marrykilledbymoney. ¿é¥X¡G Killyou,killme. Someonekill Justmake. ¥Î¨Ò8¡G$&$`$'ªº²[¸q $_="OK!Let'sgo!Veryhappy!"; /Very/; print'$&==>'.$&."\n"; print'$`==>'.$`."\n"; print'$\'==>'.$'."\n"; ¿é¥X¡G $&==>Very $`==>OK!Let'sgo! $'==>happy!<<>>8.2¼Ë¦¡¦r¤¸¶°Up8.4¸m´«



請為這篇文章評分?