I don't mean to keep this thread going, BUT some questions come to mind while reading this. With alot of calls to the function ( approx 10% more than #'s in array, so ALOT ), would it be quicker to just put the function stuff in the do loop? Also, I don't think a tied array would do any good for me ( if I understand tied arrays ).
-----Original Message----- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Friday, April 05, 2002 3:24 PM To: [EMAIL PROTECTED] Subject: Re: Print Question > Hello all. I have been working on this all day. Excellent, you'll appreciate my 5 minutes of effort all the more :P > I am trying to print out numbers 1 through 10 as this loop progesses. > For some reason, it doesn't print the numbers until the end of the loop. If you have that problem, try: $| = 1; at the top of your code to turn on autoflushing. See: perldoc perlvar for details. ----- > The $done variable is set to 1 by the getUniqRand() > function once certain conditions are met. & > do{ > getUniqRand( $lines, $opt_s ); > ... > } until $done; Don't do it that way, do this: sub getUniqRand { ... return $done; } while (1) { my $data = getUniqRand(...); last if $data; } or using the do loop as you were, but changing $data is a BAD IDEA (TM). > The @random_numbers array is filled up one by one from the getUniqRand() > function. Okay, but why one by one... > $opt_s is the number of elements in @random_numbers when it is done. when what is done? Shouldn't you fill @random_numbers in one go? > So if I am going to have 10,000 number in the array, I want to print > a digit each time another 1,000 are added to the array. Arrrrrrgggg!!! [On the web nobody can hear you screeeeeeam] This sounds like a case for tied arrays, have a look at: perldoc perltie for details on this amazing feature. No other language lets you redefine the behaviour of built-in types like Perl does. Never used ties myself, but I'm sure they are easy enough if you need them. There is plenty of documentation between the Camel and the Cookbook. 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] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]