1 |
open(WHOHANDLE, "who|"); # opens WHOHANDLE for reading output of system call to who
|
2 |
the | at right means we will be able to treat output of who as though we were reading it as a file
|
3 |
@whosaid = <WHOHANDLE> ; # defines an array whosaid holding output of who command
|
4 |
open(LPRHANDLE,"|lpr -Pgcf"); # with | at left opens lpr process so that if we write to filehandle LPRHANDLE it is as though we handed file to input of lpr
-
print LPRHANDLE "This is a test\n"; # for example
|
5 |
close(LPRHANDLE); # waits until lpr command has finished and closes handle
|