Hi My sincere thanks go to all those who answered and are answering my question about - passing array to a function. This is my first time on a technical mailing list and so had trouble expressing my questions.
I started PERL recently and am primarily from a C programming background. My intentions were not to offend anybody but to learn. _____________________________________________ my $coordinates = "Novice - with a different programming language background"; #Please dont cast this reference \$coordinates as bad. my $greetings = "Thank you all" my $intentions = "Not trying to be a braggart" #with little PERL knowledge #Satya::Novice_City _____________________________________________ "Paul Johnson" <[EMAIL PROTECTED]> To: "Rob Dixon" <[EMAIL PROTECTED]> Sent by: "Paul cc: [EMAIL PROTECTED] Johnson" Subject: Re: Passing array to a function <[EMAIL PROTECTED]> 12/19/2002 02:19 PM On Thu, Dec 19, 2002 at 03:45:56PM -0000, Rob Dixon wrote: > The proper way to return arrays from a function is to pass them by > reference. I don't know if I would go that far. There is nothing wrong with returning a list from a function, but if the list gets too big (handwave here) then you might run into efficiency issues. > Change the last line of getTimeInfo() to > > return \@results; > > and dereference in the call, like this > > @results = @{getTimeInfo()}; And this copy is doing (about) the same amount of work as returning the list in the first place. > "Satya Devarakonda" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, > > > > How can I pass an array to a function and get values back in it??? Here > > are excerpts from my code. Pass a reference to the array into the function and modify the array in the function. Though in your example you don't need to pass anything in to the function. You might also like to look into some of the Date modules already available. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- 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]