Re: backticks

2006-08-20 Thread John W. Krahn
John Ackley wrote: > thanks to all who replied > > down to this > > # perl -e "print unlink glob > '/usr/local/billmax/html/images/day-0020a6-5a9bfc*';" > 1 > > but in script > > my $oldimage = "/usr/local/billmax/html/images/day-0020a6-5a9bfc*"; > my $files = unlink glob $oldimage; > > fails

Re: backticks

2006-08-20 Thread John Ackley
and perl -e '$oldimage = "/usr/local/billmax/html/images/day-0020a6-5a9bfc*";$files = unlink glob $oldimage;printf "Files %d\n",$files;' Files 1 works # cat test.pl #! /usr/bin/perl -w use strict; my $oldimage = "/usr/loc

Re: backticks

2006-08-20 Thread John Ackley
thanks to all who replied down to this # perl -e "print unlink glob '/usr/local/billmax/html/images/day-0020a6-5a9bfc*';" 1 but in script my $oldimage = "/usr/local/billmax/html/images/day-0020a6-5a9bfc*"; my $files = unlink glob $oldimage; fails -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: backticks

2006-08-19 Thread Ken Foskey
On Sat, 2006-08-19 at 16:59 -0400, John Ackley wrote: > Thanks > > in line comments > > Tom Phoenix wrote: > > On 8/19/06, John Ackley <[EMAIL PROTECTED]> wrote: > > > >> `/bin/rm -f \"$oldimage\"`; > >> `/bin/rm /tmp/errormessage`; > > > > Why not simply use Perl's unlink function? > > apparent

Re: backticks

2006-08-19 Thread Tommy Nordgren
On Aug 19, 2006, at 10:59 PM, John Ackley wrote: Thanks in line comments Tom Phoenix wrote: On 8/19/06, John Ackley <[EMAIL PROTECTED]> wrote: `/bin/rm -f \"$oldimage\"`; `/bin/rm /tmp/errormessage`; Why not simply use Perl's unlink function? apparently unlink will not deal with wild c

Re: backticks

2006-08-19 Thread John Ackley
Thanks in line comments Tom Phoenix wrote: On 8/19/06, John Ackley <[EMAIL PROTECTED]> wrote: `/bin/rm -f \"$oldimage\"`; `/bin/rm /tmp/errormessage`; Why not simply use Perl's unlink function? apparently unlink will not deal with wild cards in $oldimage (needed to clean up garbage) seco

Re: backticks

2006-08-19 Thread Tom Phoenix
On 8/19/06, John Ackley <[EMAIL PROTECTED]> wrote: `/bin/rm -f \"$oldimage\"`; `/bin/rm /tmp/errormessage`; Why not simply use Perl's unlink function? `/usr/local/bin/gnuplot $gpfile 2>&1 >/tmp/errormessage` ; Use backticks if you're interested in the output. But if you're not looking at t

RE: Backticks alternative?

2004-07-06 Thread Tim Johnson
Cc: Subject: Re: Backticks alternative? > $exec = "ls -l"; > $src = syscall($exec); > > sub syscall{ >return `$_[0]`; > } > > should work. Sh

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 additiona

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 2>&1|")|| die "Could not open file handle\n"; while() { print $_,"\n"; } close(CMD) || die "Could

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 operat

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 s

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 = "

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 =

Re: Backticks alternative?

2004-07-05 Thread Prasanna Kothari
Try this local *CMD; $cmd = "dir"; open(CMD,"$cmd 2>&1|")|| die "Could not open file handle\n"; while() { 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,

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 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 and variable assignment - thanks

2004-03-23 Thread WC -Sx- Jones
[EMAIL PROTECTED] wrote: this does have to run on multiple servers so that is a concern, but all servers are identical in everyway This is where Yoda sez: "So sure are you?" -- _Sx_ http://youve-reached-the.endoftheinternet.org/ _ perldoc -qa.a | perl -lpe '($_)=m("(.*)")' | grep Martian --

Re: backticks and variable assignment - thanks

2004-03-23 Thread jeffrey_n_Dyke
On Mar 23, 2004, at 9:12 AM, [EMAIL PROTECTED] wrote: >> Hello, >> >> I have some code that is using backticks, executing commands on the >> korn >> shell.(if that matters). Most work as expected and i get the output >> of the >> shell command assigned to the variable left of the argument, like

Re: backticks and variable assignment

2004-03-23 Thread Wiggins d Anconia
> Hello, > > I have some code that is using backticks, executing commands on the korn > shell.(if that matters). Most work as expected and i get the output of the > shell command assigned to the variable left of the argument, like with this > ls command and 'db2 connect' command. > > $is

Re: backticks and variable assignment

2004-03-23 Thread James Edward Gray II
On Mar 23, 2004, at 9:12 AM, [EMAIL PROTECTED] wrote: Hello, I have some code that is using backticks, executing commands on the korn shell.(if that matters). Most work as expected and i get the output of the shell command assigned to the variable left of the argument, like with this ls comma

Re: Backticks Command Execution

2001-11-22 Thread Mark Veinot
A better way to get PATH would be: $pat = $ENV{PATH}; (forgive me if this doesn't work in win32-perl, I'm a Unix hacker at heart :) -- How long will a floating point operation float? Mark Veinot Network Administrator Linux Certified Professional - Original Message - From: "Veeraraju_M

Re: backticks

2001-07-02 Thread Michael Fowler
On Mon, Jul 02, 2001 at 04:06:47PM -0300, Silvio Luis Leite Santana wrote: > It seems the backtick operator calls the shell, otherwise > it wouldn't be able to redirect output to file saida. Backticks aren't the only thing that uses the shell, nor do they always use the shell. A simple `pwd` won