Re: directing output

2001-12-21 Thread Michael R. Wolf
"John W. Krahn" <[EMAIL PROTECTED]> writes: > > > my $MBody = `who`; > > > my $MBody = qx(who); # same thing > > > > IMHO qx() is more readable. I often miss seeing the > > back-ticks, or see them as single-quotes during a code skim. > > You need an editor with good syntax highlighting. :-)

Re: directing output

2001-12-21 Thread John W. Krahn
"Michael R. Wolf" wrote: > > "John W. Krahn" <[EMAIL PROTECTED]> writes: > > > my $MBody = `who`; > > my $MBody = qx(who); # same thing > > IMHO qx() is more readable. I often miss seeing the > back-ticks, or see them as single-quotes during a code skim. You need an editor with good syntax h

Re: directing output

2001-12-21 Thread Michael R. Wolf
"John W. Krahn" <[EMAIL PROTECTED]> writes: > my $MBody = `who`; > my $MBody = qx(who); # same thing IMHO qx() is more readable. I often miss seeing the back-ticks, or see them as single-quotes during a code skim. -- Michael R. Wolf All mammals learn by playing! [EMAIL PROTECTED]

Re: directing output

2001-12-19 Thread John W. Krahn
Aaron wrote: > > 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() { >$MBody .= $_; > } > > So this section gives me the

Re: directing output

2001-12-19 Thread smoot
> "Shawn" <[EMAIL PROTECTED]> said: > #!/usr/bin/perl -w > > use strict; > open(IN, 'who | '); > my @array=; > close(IN); > > open(FILE,'>file.txt') or die "Can't write file.txt: $!\n"; > print FILE @array; > close(FILE); Or the line at a time case when your input is potentially arbitrarily si

Re: directing output

2001-12-19 Thread Shawn
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=; close(IN); open(FILE,'>file.txt') or die "Can't write file.txt: $!\n"; print FILE @array; close(FILE); exit; Shawn - Original Message -