@ARGV question

2002-03-18 Thread Laycock, Angus
Hi There. I have this piece of code which I call with the following; array.csh one two three four five sic cod #!/opt/perl-5.6.1/bin/perl -w $count=0; print ARGV $#ARGV\n\n; while ($ARGV) { print count $count $ARGV[$count]\n; $count++; } I get the following output: ARGV 4

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
Jonathan, $ARGV[$count] represents the index of the array. I am passing in parameters and some contain space between two words and I noticed that using while (@ARGV) it loops the exact amount of times per words, not per parameter. So if I passed Hi There it goes around the loop twice rather than

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
Jonathan, Thanks for your help. I just want the info in the parameters that I was passing and changing it to foreach loop has done the job. I just assumed the while loop would do what I wanted. Thanks for your help again. Angus -Original Message- From: Jonathan E. Paton

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
Jenda, Thanks for a very impressive answer. Angus -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: 18 March 2002 12:05 To: Laycock, Angus; [EMAIL PROTECTED] Subject: RE: @ARGV question From: Laycock, Angus [EMAIL PROTECTED] $ARGV[$count] represents the index

Changing STDERR

2002-02-19 Thread Laycock, Angus
Please, Can someone tell me how to change STDERR to output to a file then change it back to its original output. my $oldout = select STDERR; print STDERR test1\n; open STDERR, test.txt or die Can't open file STDERR [OUTPUT]; print STDERR test2\n;# goes to file select $oldout;

RE: Changing STDERR

2002-02-19 Thread Laycock, Angus
Job sorted, it works!!! Thanks you all for your help. Gus -Original Message- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: 19 February 2002 15:20 To: '[EMAIL PROTECTED]' Subject: Re: Changing STDERR From: Laycock, Angus [EMAIL PROTECTED] Can someone tell me