in reply to Strange piece of code!

select returns the currently selected filehandle. So, this is doing what you appear to expect:

select(ERRFP), $| = 1

then, within its parentheses, it generates a list:

(last_selected_filename, 1)

Taking the first index of that list ((last_selected_filename, 1)[0]) gives:

last_selected_filename

Finally, this leaves you with:

select(last_selected_filename);

In short, you select ERRFP and make it unbuffered, then reselect the original filehandle. All in one line. Haven't seen this is ages. :-)

Update: I just remembered where I did see this last: using format about a decade ago. See perlform - Format Variables for examples of less uglier ways to do the same thing.

-- Ken

Replies are listed 'Best First'.
Re^2: Strange piece of code!
by solegaonkar (Beadle) on Jul 26, 2012 at 10:13 UTC
    Thank you Ken!