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 [mailto:[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 > 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. Could you clarify something for me: Is this supposed to represent a subroutine or a script? If that's the former, then you definately don't want to use @ARGV. You'd want: sub function { foreach my $arg (@_) { print "Got argument: $arg\n"; } } If it's the latter, then remember: @ARGV is a special variable holding filenames to be processed. When you do: while (<ARGV>) { } you are really iterating over these files in sequence and you can't do them out of sequence. Perl has abilities to treat files as arrays, but remember that the index is reset for every file... your script doesn't do that. Again, if you want the arguments and not the information within those files use: foreach (@ARGV) { } I hope this helps, otherwise please provide the clarification I need. Take care, 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]