On Apr 5, 2011, at 8:49 AM, Shawn H Corey wrote:
> You could use open:
>
> #!/usr/bin/env perl
>
> use strict;
> use warnings;
>
> open my $ls_fh, '-|', 'ls' or die "could not open `ls`: $!\n";
> chomp( my @files = <$ls_fh> );
> close $ls_fh or die "could not open `ls`: $!\n";
>
> print "@files\n";
> __END__
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";
__END__
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/