On Tue, 6 Jul 2004 00:28:57 -0400, gohaku <[EMAIL PROTECTED]> wrote:
> Hi everyone,
> After using backticks to retrieve executable output,
> I would like to know if there is a backtick alternative.
> 
> For example, to get a File Listing on a Unix-based system,
> I will do the usual:
> 
> $exec = "ls -l";
> $src = `$exec`;
> 
> Unfortunately, I find the ` to be unreadable and confusing
> because it looks like a quote.

Hello Gohaku,

Please look at the "perlop" documentation (using perldoc perlop). If you search
for "qx", you'll find that you can do the same as above like this:

#!/usr/bin/perl

use strict;
use warnings;
my $exec = "ls -l";
my $src = qx{$exec};

print "src = $src\n";
__END__

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to