Re: Backticks alternative?

2004-07-06 Thread John W . Krahn
On Monday 05 July 2004 21:28, gohaku wrote: Hi everyone, Hello, 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`;

Re: Backticks alternative?

2004-07-06 Thread Brian Eable
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;

Re: Backticks alternative?

2004-07-06 Thread Gunnar Hjalmarsson
Suresh Pasupula wrote: Gohaku wrote: After using backticks to retrieve executable output, I would like to know if there is a backtick alternative. You can use in the following way: $exec = ls -l; $src = system($exec); Please read perldoc -f system to find out why you typically can *not* use

Re: Backticks alternative?

2004-07-06 Thread Gunnar Hjalmarsson
Tim Johnson wrote: Gohaku wrote: After using backticks to retrieve executable output, I would like to know if there is a backtick alternative. If you want the exact same function as the backticks, why not just make a small subroutine? Maybe because it's unnecessary, since there already is an

Re: Backticks alternative?

2004-07-06 Thread Gunnar Hjalmarsson
Prasanna Kothari wrote: Gohaku wrote: After using backticks to retrieve executable output, I would like to know if there is a backtick alternative. Try this local *CMD; $cmd = dir; open(CMD,$cmd 21|)|| die Could not open file handle\n; while(CMD) { print $_,\n; } close(CMD) || die Could not

Re: Backticks alternative?

2004-07-06 Thread Gunnar Hjalmarsson
Gunnar Hjalmarsson wrote: Hmm.. Is there any situation when it's motivated to do that instead of using backticks (or the qr// operator)? Sorry.. I meant the qx// operator. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

RE: Backticks alternative?

2004-07-06 Thread Tim Johnson
: Subject: Re: Backticks alternative? snip $exec = ls -l; $src = syscall($exec); sub syscall{ return `$_[0]`; } should work. Should it? Did you try it? syscall() is a built

RE: Backticks alternative?

2004-07-05 Thread suresh.pasupula
You can use in the following way: $exec = ls -l; $src = system($exec); -Original Message- From: gohaku [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 06, 2004 9:59 AM To: Perl Beginners Subject: Backticks alternative? Hi everyone, After using backticks to retrieve executable output, I

RE: Backticks alternative?

2004-07-05 Thread Tim Johnson
If you want the exact same function as the backticks, why not just make a small subroutine? # $exec = ls -l; $src = syscall($exec); sub syscall{ return `$_[0]`; } # should work. -Original Message- From: gohaku [mailto:[EMAIL

Re: Backticks alternative?

2004-07-05 Thread Prasanna Kothari
Try this local *CMD; $cmd = dir; open(CMD,$cmd 21|)|| die Could not open file handle\n; while(CMD) { print $_,\n; } close(CMD) || die Could not close $cmd $!\n; The program is printing to STDOUT. --Prasanna gohaku wrote: Hi everyone, After using backticks to retrieve executable output, I would