Re: 1 doubt.
On Thu, Dec 11, 2003 at 09:27:48AM +, Ajey Kulkarni wrote: perl t.pl Name main::FH used only once: possible typo at t.pl line 6. You opened a file, but you do not read from the file. Just opened it. This doesn't make much sense. So you get a warning. cat t.pl #!/usr/bin/perl use strict; use warnings; open FH, out.dat; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: -e with single quotes
On Wed, Dec 10, 2003 at 05:05:26PM -0600, Dan Muey wrote: perl -e 'print joe's mama;' Obvo=iously won't work perl -e 'print joe\'s mama;' And any other versions of \\' all fail. As you were told, this is a question of your shell. If you are using a bourne shell (zsh, bash, ksh, etc...) try this: perl -e 'print joe'\''s mama;' ^ ^ ^^^ 1 2 345 The trick is: 1. start single quoted string 2. end single quoted string 3. escaped single quote 4. start single quoted string 5. end single quoted string -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
pid of process opened by system
Hello, I'm doing this: eval { local $SIG{ALRM} = sub { die alarm\n }; alarm 10; system($prog, @args); alarm 0; } if($@ =~ /alarm/) { # have to kill $prog; } The problem is, that the process is still running after the perl script has exited. And I have to kill it by hand. But I want perl to do the job. regards, Mik -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: pid of process opened by system
On Tue, Dec 09, 2003 at 01:04:01AM +0100, [EMAIL PROTECTED] wrote: eval { local $SIG{ALRM} = sub { die alarm\n }; alarm 10; system($prog, @args); alarm 0; }; if($@ =~ /alarm/) { # have to kill $prog; # I tried with 'use POSIX qw/sys_wait_h/;' my $kid = waitpid -1, WNOHANG; print $kid\n; kill 15, $kid; } But this doesn't work, because waitpid returns 0 while the child is running. regards, Mik -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response