in reply to counting strings ending with a in dataset
There’s an important distinction between davido’s solution and yours. You “slurped” the entire file into memory; David read it line-by-line. Most of the time, you want to do it David’s way because otherwise you’re doing a great big file-copy ... from a disk file, to the virtual-memory file! You almost never want to do that.