Re: using backticks

2006-10-06 Thread John W. Krahn
john wright wrote: > Hi All, Hello, > i am getting error "The system cannot find the path specified" while running > below lines code. > > $dirname = "util"; > $path = ` cd $dirname ; pwd` > print ("$path"); > > can anybody help me to get output of pwd in the variable $path. use Cwd; my $dir

Re: using backticks

2006-10-06 Thread Rob Dixon
john wright wrote: > > i am getting error "The system cannot find the path specified" while running > below lines code. > > $dirname = "util"; $path = ` cd $dirname ; pwd` print ("$path"); > > can anybody help me to get output of pwd in the variable $path. Hi John It's best to do things in Perl

using backticks

2006-10-06 Thread john wright
Hi All, i am getting error "The system cannot find the path specified" while running below lines code. $dirname = "util"; $path = ` cd $dirname ; pwd` print ("$path"); can anybody help me to get output of pwd in the variable $path. Thank

Re: using backticks

2006-07-09 Thread Mahdi A Sbeih
Hi Ron, Thank you very very much, -Mahdi. Rob Dixon wrote: Mahdi A Sbeih wrote: > > I am using the below code: > > $fmtFile = `$dpImportCmd`; > .. > .. > unlink($fmtFile) || die "unable to remove $fmtFile\n"; > > > dpImportCmd, is a program that generates a text file, this text file > name i

Re: using backticks

2006-07-09 Thread Rob Dixon
Mahdi A Sbeih wrote: > > I am using the below code: > > $fmtFile = `$dpImportCmd`; > .. > .. > unlink($fmtFile) || die "unable to remove $fmtFile\n"; > > > dpImportCmd, is a program that generates a text file, this text file > name is now in the variable: $fmtFile. Later in the program, I want to

using backticks

2006-07-09 Thread Mahdi A Sbeih
I am using the below code: $fmtFile = `$dpImportCmd`; .. .. unlink($fmtFile) || die "unable to remove $fmtFile\n"; dpImportCmd, is a program that generates a text file, this text file name is now in the variable: $fmtFile. Later in the program, I want to delete this file, but it fails. I don'

Re: loop using backticks stalls after ~30x

2004-04-02 Thread Smoot Carl-Mitchell
On Fri, 02 Apr 2004 16:22:51 +0200 Martin Lercher <[EMAIL PROTECTED]> wrote: > >ps uf > 2740 pts/7S 0:00 \_ /usr/bin/perl ./t5.pl > 2894 pts/7T 0:00 \_ ls > 2895 pts/7Z 0:00 \_ [ls ] Strange. It looks like ls has forked a copy of itself and is wai

Re: loop using backticks stalls after ~30x

2004-04-02 Thread WC -Sx- Jones
Martin Lercher wrote: #!/usr/bin/perl for (my $j=0;$j<1;$j++) { my $result = `ls` ; print $result ; } >ps uf 2740 pts/7S 0:00 \_ /usr/bin/perl ./t5.pl 2894 pts/7T 0:00 \_ ls 2895 pts/7Z 0:00 \_ [ls ] I don't think that is Perl; the O

loop using backticks stalls after ~30x

2004-04-02 Thread Martin Lercher
Hi, I'm trying to repeatedly call some external program from Perl using backticks. This works fine for ~30 rounds, but then the program stops doing anything, with a process hanging around (apparently Perl ignores its dead child?). A simple example is this: #!/usr/bin/perl for (my $j

RE: Avoid using backticks

2002-07-29 Thread NYIMI Jose (BMB)
Thanks George, I will try ... José. -Original Message- From: George Schlossnagle [mailto:[EMAIL PROTECTED]] Sent: Monday, July 29, 2002 10:27 AM To: NYIMI Jose (BMB) Cc: [EMAIL PROTECTED] Subject: Re: Avoid using backticks You can use the File::Find module. It even has a find2perl

RE: Avoid using backticks

2002-07-29 Thread NYIMI Jose (BMB)
2 10:15 AM To: [EMAIL PROTECTED]; NYIMI Jose (BMB) Subject: Re: Avoid using backticks You should be able to do it with opendir (to open directories and browse the contents) and unlink (to delete files) take a look at the man pages for those two to get you started, if you're still struggling ju

Re: Avoid using backticks

2002-07-29 Thread George Schlossnagle
You can use the File::Find module. It even has a find2perl utility for taking the work of writing a matching subroutine out: Then you get something like #!/usr/local/bin/perl -w use strict; use FindBin qw{$Bin}; use File::Find; find(\&wanted, $Bin); sub wanted { (my ($dev,$ino,$mode,$nl

Re: Avoid using backticks

2002-07-29 Thread Nigel Peck
You should be able to do it with opendir (to open directories and browse the contents) and unlink (to delete files) take a look at the man pages for those two to get you started, if you're still struggling just ask again. HTH Nigel >>> "NYIMI Jose (BMB)" <[EMAIL PROTECTED]> 07/29/02 08:37am

Avoid using backticks

2002-07-29 Thread NYIMI Jose (BMB)
Hello, I would like to clean up my logfile directory by removing files that are older than 7 days. So I wrote something like: /user/local/bin/perl -w use strict; use FindBin qw($Bin); # `find $Bin -mtime +7 -name '*.log' -exec rm {} \;`; # __END__ My question is: how can I use perl's synthax i

Re: $! after using backticks

2001-05-23 Thread Randal L. Schwartz
> "Timothy" == Timothy Kimball <[EMAIL PROTECTED]> writes: Timothy> As for always getting that weird error message from $!, I always Timothy> get "Illegal seek" on my machine. You should never look at $! unless immediately following a *failed* system-related call. A successful call doesn't

RE: $! after using backticks

2001-05-23 Thread Mitchell, Ronald
ris and Windows.) Thanks again - I'd been struggling with this for ages. (And thanks to the others who've replied as I've been typing this!) Ron -Original Message- From: Peter Cornelius [mailto:[EMAIL PROTECTED]] Sent: 23 May 2001 19:14 To: 'Mitchell, Ronald'; '[

Re: $! after using backticks

2001-05-23 Thread Me
Enter: perldoc perlvar and then look at the entries for $CHILD_ERROR ($?) and $ERRNO ($!). There can be other issues about return values, but start with the above.

Re: $! after using backticks

2001-05-23 Thread Timothy Kimball
Ron Mitchell wrote: : I want to check that a backtick command has executed OK. I thought I could : do that by looking at the $! variable. Check $? instead. This one's for pipes, backticks, & system() commands. It's a fairly complex flag, with a lot of stuff in it, but briefly, $? >> 8 contains t

RE: $! after using backticks

2001-05-23 Thread Peter Cornelius
>I want to check that a backtick command has executed OK. I thought I could >do that by looking at the $! variable. Check $? This is Child exit status which is what you get when you spawn another process with back ticks. The $! is the ERRNO (or Error string depending on context) for the last sy

$! after using backticks

2001-05-23 Thread Mitchell, Ronald
Hi. Can someone explain this to me? I want to check that a backtick command has executed OK. I thought I could do that by looking at the $! variable. But I find that if I do this for example $output = `pwd` ; print "$output\n" ; print "\$! = $!\n" ; I get /home/ron $! = No such file or direc