ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
3.2.134 select (output filehandle)select For historical reasons, there are two select
operators that are totally unrelated to each other. See the next section for
the other one. This select operator returns
the currently selected output filehandle, and if
select REPORT1; $^ = 'MyTop'; select REPORT2; $^ = 'MyTop'; But note that this leaves my $oldfh = select STDERR; $| = 1; select $oldfh; or (being bizarre and obscure): select((select(STDERR), $| = 1)[0]) This example works by building a list consisting of the returned value from
However, now that we've explained all that, we should point out that you rarely
need to use this form of select nowadays,
because most of the special variables you would want to set have object-oriented
wrapper methods to do it for you. So instead of setting use FileHandle; STDOUT->autoflush(1); And the earlier format example might be coded as: use FileHandle; REPORT1->format_top_name("MyTop"); REPORT2->format_top_name("MyTop"); |