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[$co

RE: @ARGV question

2002-03-18 Thread Jenda Krynicky
From: "Laycock, Angus" <[EMAIL PROTECTED]> > $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. I see. So you wanted

Re: @ARGV question

2002-03-18 Thread Jenda Krynicky
From: "Laycock, Angus" <[EMAIL PROTECTED]> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> Subject:@ARGV question Date sent: Mon, 18 Mar 2002 10:56:39 - > Hi There. > > I have

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
:[EMAIL PROTECTED]] Sent: 18 March 2002 11:34 To: [EMAIL PROTECTED] Subject: RE: @ARGV question > $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 >

RE: @ARGV question

2002-03-18 Thread Jonathan E. Paton
> $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 rathe

RE: @ARGV question

2002-03-18 Thread Laycock, Angus
oop twice rather than once. On the second iteration there is no value to process. Angus -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: 18 March 2002 11:05 To: [EMAIL PROTECTED] Subject: Re: @ARGV question > while (<$ARGV>) { > print &

Re: @ARGV question

2002-03-18 Thread Jonathan E. Paton
> while (<$ARGV>) { > print "count $count $ARGV[$count]\n"; > $count++; > } What is $ARGV[$count]? Is it supposed to be the line of the file? Either use: my @file = ; foreach my $line (@file) { print 'count' . $count++ . $_ . "\n"; } Or: while () { print "count $. $

@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 out