in reply to Re^3: Counting bytes in a Unicode document
in thread Counting bytes in a Unicode document

It's worth also mentioning the idiom of stat $file; ... (stat(_))[7] to use the result of the last stat.

Replies are listed 'Best First'.
Re^5: Counting bytes in a Unicode document
by ikegami (Patriarch) on Oct 15, 2024 at 15:38 UTC

    If it's worth mentioning, it's as something to avoid. -s _ is a million times more readable than +(stat(_))[7].

      The point, which regrettably you missed, wasn't the (stat etc)[n] idiom. It's the use of _ as an argument to these operations to reuse the cached results of the last one.

        I used "_" in the post to which you replied. How could I have missed a point you didn't actually make? Like I said, your version ((stat(_))[7]) is—in my opinion—strictly worse than what I posted (-s _).