0
-0digit =>
指定輸入記錄分隔符($ /)作爲一個八進制數。如果沒有給出數字,則空字符是分隔符。其他開關可以在數字後面。 -00將Ruby轉換爲段落模式。 -0777使Ruby一次讀取整個文件作爲單個字符串,因爲沒有合法的字符與該值。
我的壞!根本無法消化它。所以讓我們開始玩吧。
C:\>ruby -0777 -e 'a= gets; puts a '
Hi, This is Ram.
Could you help me here?
^Z #~~~> pressed ENTER here after CTRL+Z and got the output as below-
Hi, This is Ram.
Could you help me here?
C:\>ruby #~~~> return the prompt
C:\>ruby -000 -e 'a= gets; puts a '
Hi, This is Ram.
Could you help me here?
^Z #~~~> pressed ENTER here after CTRL+Z and got the output as below-
Hi, This is Ram.
Could you help me here?
C:\>ruby #~~~> return the prompt
C:\>ruby -00 -e 'a= gets; puts a '
Hi, This is Ram.
Could you help me here? #~~~> pressed ENTER
#~~~> pressed ENTER here and got the output as below-
Hi, This is Ram.
Could you help me here?
C:\>ruby #~~~> return the prompt
問題:1 -我可以設置這樣octal
或$/
爲下面?
carraige return (\r)
tab (\t)
如果是這樣,我可以有一個例子讓每個人看到他們的行爲?
問題:2 - 我也試圖打印的"$/"
並沒有打印任何價值。那我應該怎麼看?
C:\>ruby -00 -e 'a= gets; puts a ;puts "here is: #{$/}"'
hi
hi
here is:
C:\>ruby -0777 -e 'a= gets; puts a ;puts "here is: #{$/}"'
Hey! Arjun
Are you going school?
^Z
Hey! Arjun
Are you going school?
here is:
C:\>
任何人都可以請驗證我的答案嗎?或者如果有更多我需要放在那裏? – 2013-02-22 22:40:16