Hey Aaron, I am not familiar with the 'who' command, but you can probably do this:
#!/usr/bin/perl -w use strict; open(IN, 'who | '); my @array=<IN>; close(IN); open(FILE,'>file.txt') or die "Can't write file.txt: $!\n"; print FILE @array; close(FILE); exit; Shawn ----- Original Message ----- From: "Aaron" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 19, 2001 9:20 AM Subject: directing output > I have the following code that I am using to try and get a better > understanding of how to read from a program and then process the output in > any way needed: > > #!/usr/bin/perl -w > > open(IN, 'who | '); > while(<IN>) { > $MBody .= $_; > } > > So this section gives me the contents of the who command. Now, what I'm > trying to do is figure out how to write $MBody into a file. I know that I > have to open a new file, or can I do it in my prior while?, but am not sure > on how to get the contents of $MBody into the file. All of my previous > attempts have left the file empty. > > Any help would be appericiated. > > Thanks! > Aaron M. Hirsch > SchlumbergerSema > Systems Administrator > 11146 Thompson Ave. > Lenexa, KS 66219 > Phone: (913) 312-4717 > Mobile: (913) 208-9806 > Fax: (913) 312-4701 > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]