RE: remote login using perl

2006-10-19 Thread Sayed, Irfan \(Irfan\)
I need to login on remote machine which is windows , and i think windows doesent support ssh login unless ssh server installed. Either i have to use VNC , remote desktop shairing etc. I need to automate this using script. Please help. Regards Irfan. _ From: Blue Band

Re: More Info About $| = 1;

2006-10-19 Thread Andreas Puerzer
Tom Phoenix schrieb: On 10/18/06, Chris Share [EMAIL PROTECTED] wrote: I've got a question about $| = 1; If I add $| = 1; at the top of the program this fixes the problem and the program runs as expected. Normally, output is buffered for efficiency; instead of writing each

Non-blocking child process

2006-10-19 Thread Helliwell, Kim
I'm not even sure the title is the appropriate terminology. What I am trying to do is fork a process that receives data from the parent, but, once the data is received, the parent can go on and do whatever it wants (and likewise the child). How do I arrange for the child process to be detached

Re: Non-blocking child process

2006-10-19 Thread Jeff Pang
I'm not even sure the title is the appropriate terminology. What I am trying to do is fork a process that receives data from the parent, but, once the data is received, the parent can go on and do whatever it wants (and likewise the child). How do I arrange for the child process to be detached

Re: remote login using perl

2006-10-19 Thread Mumia W.
On 10/19/2006 01:11 AM, Sayed, Irfan (Irfan) wrote: I need to login on remote machine which is windows , and i think windows doesent support ssh login unless ssh server installed. Either i have to use VNC , remote desktop shairing etc. I need to automate this using script. Please help.

Evaluation of ++ different in C and perl?

2006-10-19 Thread Norbert Preining
Hi all! Maybe this has been answered before, but my searching didn't show up anything: The Perl Book says: Auto increment and decrement work as in C. So if I take this C program: #include stdio.h #include stddef.h int main() { int a; int b; a=3; b=(++a)+(a++);

Re: Hide the Window

2006-10-19 Thread Jenda Krynicky
I have created a small program which will open notepad and write something to it .. infinitely . The program will die if somebody closes the window . To cut jokes with my friends I want to

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Jenda Krynicky
To: beginners@perl.org Date sent: Thu, 19 Oct 2006 13:55:45 +0200 From: Norbert Preining [EMAIL PROTECTED] Copies to: Elisa Mori [EMAIL PROTECTED], [EMAIL PROTECTED] Subject:Evaluation of ++ different in C and perl?

Re: More Info About $| = 1;

2006-10-19 Thread Derek B. Smith
-- Andreas Puerzer [EMAIL PROTECTED] wrote: Tom Phoenix schrieb: On 10/18/06, Chris Share [EMAIL PROTECTED] wrote: I've got a question about $| = 1; If I add $| = 1; at the top of the program this fixes the problem and the program runs as expected. Normally,

Re: More Info About $| = 1;

2006-10-19 Thread Derek B. Smith
--- Derek B. Smith [EMAIL PROTECTED] wrote: -- Andreas Puerzer [EMAIL PROTECTED] wrote: Tom Phoenix schrieb: On 10/18/06, Chris Share [EMAIL PROTECTED] wrote: I've got a question about $| = 1; If I add $| = 1; at the top of the program this fixes the

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Dr.Ruud
Norbert Preining schreef: The Perl Book says: Auto increment and decrement work as in C. So if I take this C program: #include stdio.h #include stddef.h int main() { int a; int b; a=3; b=(++a)+(a++); printf(b=%d\n,b); } it prints b=8.

Re: More Info About $| = 1;

2006-10-19 Thread Chris Share
Thanks to all who responded. The Suffering from Buffering? article explains everything. Cheers, Chris Derek B. Smith wrote: --- Derek B. Smith [EMAIL PROTECTED] wrote: -- Andreas Puerzer [EMAIL PROTECTED] wrote: Tom Phoenix schrieb: On 10/18/06, Chris Share [EMAIL PROTECTED]

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Derek B. Smith
--- Dr.Ruud [EMAIL PROTECTED] wrote: Norbert Preining schreef: The Perl Book says: Auto increment and decrement work as in C. So if I take this C program: #include stdio.h #include stddef.h int main() { int a; int b; a=3; b=(++a)+(a++);

Re: Sort uniq

2006-10-19 Thread Dr.Ruud
Rob Dixon schreef: $uniq{$_} = 1 foreach @holdArr; I prefer foreach to for, mainly because it is shorter. Alternative: @[EMAIL PROTECTED] = (1) x @holdArr; Test-1: perl -MData::Dumper -wle' @keys = qw(a b c) ; @hash{ @keys } = (1) x @keys ; print Dumper \%hash ' $VAR1 = {

IF statement and multiple options

2006-10-19 Thread Robert Hicks
I am currently building the IF statement like: if ($project_name eq 'Proj1' || $project_name eq '' $task_name eq '') That works but I was wondering if I can do this: if ($project_name eq ('Proj1' || '') $task_name eq '') Less typing... : ) Robert -- To unsubscribe, e-mail: [EMAIL

Re: IF statement and multiple options

2006-10-19 Thread Rob Dixon
Robert Hicks wrote: I am currently building the IF statement like: if ($project_name eq 'Proj1' || $project_name eq '' $task_name eq '') That works but I was wondering if I can do this: if ($project_name eq ('Proj1' || '') $task_name eq '') Less typing... : ) No. Because ('Proj1' ||

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Rob Dixon
Derek B. Smith wrote: --- Dr.Ruud [EMAIL PROTECTED] wrote: Norbert Preining schreef: The Perl Book says: Auto increment and decrement work as in C. So if I take this C program: #include stdio.h #include stddef.h int main() { int a; int b; a=3;

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Norbert Preining
Dr.Ruud wrote: $ perl -wle ' $a = 3; $b = 0 + (++$a) + ($a++); print b=$b\n; ' b=8 :) Nup, this is not the solution: $a = 3; $b = 0; $b = 0 + (++$a) + ($a++); $c = 3; $d = 0; $d = (++$c) + ($c++); print b=$b\n; print d=$d\n; prints: b=8 d=9 Don't tell me that in perl 0 +

Re: Perl Script as a Cron Job

2006-10-19 Thread Mazhar
On 10/12/06, Paul [EMAIL PROTECTED] wrote: On Wed, October 11, 2006 7:03 am, Mazhar wrote: Dear All, My Code is to ping a range of IP reading from a text file and if they are not reachable then just write the IP's to a file. Regarding permissions i am running the same script using root

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Derek B. Smith
--- Rob Dixon [EMAIL PROTECTED] wrote: Derek B. Smith wrote: --- Dr.Ruud [EMAIL PROTECTED] wrote: Norbert Preining schreef: The Perl Book says: Auto increment and decrement work as in C. So if I take this C program: #include stdio.h #include stddef.h int main() {

Re: IF statement and multiple options

2006-10-19 Thread Tom Phoenix
On 10/19/06, Robert Hicks [EMAIL PROTECTED] wrote: I am currently building the IF statement like: if ($project_name eq 'Proj1' || $project_name eq '' $task_name eq '') Because logical-and is higher precedence than logical-or, that condition is the same as this: $project_name eq 'Proj1'

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Tom Phoenix
On 10/19/06, Norbert Preining [EMAIL PROTECTED] wrote: $b = (++$a) + ($a++); I'm not sure whether C does so, but I believe that Perl does NOT promise that auto-increments will be executed in the expected left-to-right order. Thus, if a single expression includes more than one auto-increment

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread lawrence
Tom writes: I'm not sure whether C does so, but I believe that Perl does NOT promise that auto-increments will be executed in the expected left-to-right order. Thus, if a single expression includes more than one auto-increment working on the same variable, generally you can't be sure what

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Taha Hafeez Siddiqi
On Thu, 2006-10-19 at 15:20 +0200, Jenda Krynicky wrote: To: beginners@perl.org Date sent:Thu, 19 Oct 2006 13:55:45 +0200 From: Norbert Preining [EMAIL PROTECTED] Copies to:Elisa Mori [EMAIL PROTECTED], [EMAIL PROTECTED] Subject:

Re: Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Tom Phoenix
On 10/19/06, Norbert Preining [EMAIL PROTECTED] wrote: BUT: Even if we consider *both* ways of evaluation the expression tree, we arrive at 8: There's more than both ways to do it. I suspect that this is a result of an optimization that assumes that no variable will appear at in multiple

Re: Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Tom Phoenix
On 10/19/06, Rob Dixon [EMAIL PROTECTED] wrote: so the final values of $a and $b are the same regardless and Perl is definitely doing something wrongly in the single-line version. I would argue that the programmer did something wrongly by abusing the auto-increment. But don't let that stop

RE: Non-blocking child process

2006-10-19 Thread Helliwell, Kim
-Original Message- From: Jeff Pang [mailto:[EMAIL PROTECTED] Sent: Thursday, October 19, 2006 2:10 AM To: Helliwell, Kim; beginners@perl.org Subject: Re: Non-blocking child process Hello, I changed your codes like below: use strict; for (my $i=0;$i2;++$i) { my

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Norbert Preining
Hi Tom! On Don, 19 Okt 2006, Tom Phoenix wrote: $b = (++$a) + ($a++); I'm not sure whether C does so, but I believe that Perl does NOT No, also C does not guarantee any predescribed order. It depends on the compiler. BUT: Even if we consider *both* ways of evaluation the expression tree, we

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread lawrence
Did this come up in a real-world situation, or were you specifically seeking to test the limits of Perl? In other words, what problem, if any, are you trying to solve? Teaching Perl to students, and to get them to understand the difference between pre and post increment. So, I guess

Re: Non-blocking child process

2006-10-19 Thread Tom Phoenix
On 10/19/06, Helliwell, Kim [EMAIL PROTECTED] wrote: I would like the parent to continue independently of the child. It sounds as if you want to use the double-fork trick. The first fork produces a child process; this child forks a grandchild process, then quits. The grandchild process does

Re: Evaluation of ++ different in C and perl?

2006-10-19 Thread Paul Johnson
On Thu, Oct 19, 2006 at 09:56:58AM -0700, Tom Phoenix wrote: On 10/19/06, Rob Dixon [EMAIL PROTECTED] wrote: so the final values of $a and $b are the same regardless and Perl is definitely doing something wrongly in the single-line version. I would argue that the programmer did something

Re: Non-blocking child process

2006-10-19 Thread Dr.Ruud
Jeff Pang schreef: for (my $i=0;$i2;++$i) { Alternative: for my $i (0 .. 1) { my $pid = open CHILD,|-; One should always check the return value of open(). select CHILD;$|++;select STDOUT; Alternative: select((select(CHILD),$|=1)[0]); (from perldoc -q flush) --

Re: reading a file

2006-10-19 Thread Gerald Host
I tried both, and they typically do work for me, but right now they just aren't... QQQ line1 line2 line3 ... lineX QQQ any ideas? Ryan On 10/19/06, Helliwell, Kim [EMAIL PROTECTED] wrote: Another way: foreach $line (IN) { ... } if you don't want to slurp all the lines into an array

Re: reading a file

2006-10-19 Thread Jenda Krynicky
From: Gerald Host [EMAIL PROTECTED] I'm trying to read a text file line-by-line. open IN, shift; my @lines=split(\n,IN); Did you ever read the docs??? my @lines=IN; The operator returns the list of lines in the file if called in the list

Re: reading a file

2006-10-19 Thread xavier mas
A Divendres 20 Octubre 2006 00:34, Gerald Host va escriure: I'm trying to read a text file line-by-line. open IN, shift; my @lines=split(\n,IN); foreach my $line (@lines) { print OUT QQQ $line QQQ\n;

non-root module install

2006-10-19 Thread Mike Blezien
Hello, I need to install a perl module, Crypt::SSLeay, for a client in their local folder, /home/username it's been quiet some time since I've installed a module in this manner, to use to using either cpan or direct root installs. What is the correct procedure to installing modules in this

Re: non-root module install

2006-10-19 Thread Tom Phoenix
On 10/19/06, Mike Blezien [EMAIL PROTECTED] wrote: I need to install a perl module, Crypt::SSLeay, for a client in their local folder, /home/username it's been quiet some time since I've installed a module in this manner, to use to using either cpan or direct root installs. What is the correct

Re: non-root module install

2006-10-19 Thread Mike Blezien
Prefect! :) thx's Mike - Original Message - From: Tom Phoenix [EMAIL PROTECTED] To: Mike Blezien [EMAIL PROTECTED] Cc: Perl List beginners@perl.org Sent: Thursday, October 19, 2006 9:42 PM Subject: Re: non-root module install On 10/19/06, Mike Blezien [EMAIL PROTECTED] wrote: I