On 05/04/2011 15:11, Chap Harrison wrote:

Is there any reason not to just use qx?

#!/usr/bin/env perl

use strict;
use warnings;

chomp(my @files = qx(ls));
print "@files\n";

Hi Chap

Just being picky, this will print all of the output lines on a single
line separated by spaces. Since you probably want to see them on
separate lines, you could either not chomp

  my @files = qx(ls);
  print @files;

or append newlines on output

  chomp(my @files = qx(ls));
  print "$_\n" foreach @files;

Cheers,

Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to