# Find out who is on the system
open(WHOPROC, "who |");
while ( $nextUser = <WHOPROC> ) {
print "$nextUser\n";
}
# Print who is on the system
open(WHOPROC, "who |");
open(PRINTER, "| lpr");
while ( $nextUser = <WHOPROC> ) {
print PRINTER "$nextUser\n";
}
close(WHOPROC);
close(PRINTER);