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]

Reply via email to