"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. :-)
"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
"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]
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
> "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
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 -