Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!njin!princeton!phoenix.Princeton.EDU!subbarao From: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Newsgroups: comp.lang.perl Subject: uptime Message-ID: Date: 30 May 91 18:53:17 GMT Sender: news@idunno.Princeton.EDU Reply-To: subbarao@phoenix.Princeton.EDU (Kartik Subbarao) Organization: American Chemical Society Lines: 27 I was wondering whether there's any nicer ways to do this: $usavgs = `/usr/ucb/uptime`; if ($usavgs =~ /.*,(.*)user.*average: *(.*),(.*),(.*)/) { $users = $1; $avg1 = $2; $avg2 = $3; $avg3 = $4; } print $users, "\t", $avg1, "\t", $avg2, "\t", $avg3, "\n"; I want to get the number of users, and the load averages into different variables so I can print them out nicely for another program to scanf. I was originally thinking of doing some split()s and/or substr()s, but that would seem to take longer. How does this method compare to others? -Kartik -- internet% whoami subbarao@phoenix.Princeton.EDU -| Internet kartik@silvertone.Princeton.EDU (NeXT mail) SUBBARAO@PUCC.BITNET - Bitnet