diff options
Diffstat (limited to 'sample/samp.rb')
-rw-r--r-- | sample/samp.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sample/samp.rb b/sample/samp.rb new file mode 100644 index 0000000000..b4d818faba --- /dev/null +++ b/sample/samp.rb @@ -0,0 +1,12 @@ +単語 = 0 +while gets() + printf("%3d: %s", $., $_) + while sub(/\w+/, '') + if $& != ""; + 単語 += 1 + end + end + if ($. >= 10); break; end +end +printf("line: %d\n", $.) +printf("word: %d\n", 単語) |