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 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 "count $count $ARGV[$count]\n";
>         $count++;
> }

What is $ARGV[$count]?  Is it supposed to be
the line of the file?

Either use:

my @file = <ARGV>;

foreach my $line (@file) {
    print 'count' . $count++ . $_ . "\n";
}

Or:

while (<ARGV>) {
    print "count $. $_";
}

Note that ARGV can just be written as <>.

I *think* that is what you are looking for.

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated 
recipient(s) named above.  If you are not the intended recipient of this message you 
are hereby notified that any review, dissemination, distribution or copying of this 
message is strictly prohibited.  This communication is for information purposes only 
and should not be regarded as an offer to sell or as a solicitation of an offer to buy 
any financial product, an official confirmation of any transaction, or as an official 
statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or 
error-free.  Therefore, we do not represent that this information is complete or 
accurate and it should not be relied upon as such.  All information is subject to 
change without notice.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to