Previous Next Table of contents

9. Undocumented Features

9.1 What does a ? b : c mean?

It means if a then b else c end.

9.2 How can I count the number of lines in a file?

Assuming that the file ends in a linefeed, following code may give the fastest result. open("file").read.count("\n")

9.3 What do begin and end of MatchingData return?

They act with $~, and return the start index and the end index of matched data $0, $1... in the original string. See an example in tab expansion.
Previous Next Table of contents