Perlについての質問箱 25箱目
■ このスレッドは過去ログ倉庫に格納されています
0404デフォルトの名無しさん
2006/06/23(金) 09:49:38perlopには以下のように書いてある。
The auto-increment operator has a little extra builtin magic to it. If
you increment a variable that is numeric, or that has ever been used in
a numeric context, you get a normal increment. If, however, the vari-
able has been used in only string contexts since it was set, and has a
value that is not the empty string and matches the pattern
"/^[a-zA-Z]*[0-9]*\z/", the increment is done as a string, preserving
each character within its range, with carry:
'9z'は/^[a-zA-Z]*[0-9]*\z/にはマッチしないので普通に数値として解釈される
はずで、数ではじまって後ろに余計なものがついた文字列は余計なものを取り
除いて扱われる(この場合は9)のだから10であってると思われる。
cygwinで0になるのはわかんね。
■ このスレッドは過去ログ倉庫に格納されています