Passing array to a function

2002-12-19 Thread Satya_Devarakonda
Hi, How can I pass an array to a function and get values back in it??? Here are excerpts from my code. sub getTimeInfo { my $sec = 0; my $min = 0; my $hour = 0; my $day = 0; my $mon = 0; my $year = 0; my $IsDST = 0; my $week_day = 0; my @ti

Re: Passing array to a function

2002-12-19 Thread Rob Dixon
Satya I'm not sure why you're getting odd results - I ran the text of your post under Perl (with no changes) and got Satya - Dec19 20021219 "12/19/2002","Thursday", Satya1 - Dec19 : 20021219 : "12/19/2002","Thursday", which looks fine to me. The proper way to return arrays from a functi

Re: Passing array to a function

2002-12-19 Thread Satya_Devarakonda
cc: Subject: Re: Passing array to a function 12/19/2002 10:45

Re: Passing array to a function

2002-12-19 Thread wiggins
On Thu, 19 Dec 2002 11:04:27 -0500, [EMAIL PROTECTED] wrote: > > Thank you Sir, > > But is it not wrong to create an array in a function and send a reference > to the array back into the main function? > > Because the scope of the array is limit

Re: Passing array to a function

2002-12-19 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > > On Thu, 19 Dec 2002 11:04:27 -0500, [EMAIL PROTECTED] > wrote: > > But is it not wrong to create an array in a function and send a > > reference to the array back into the main function? > > > > Because the scope of the a

Re: Passing array to a function

2002-12-19 Thread Satya_Devarakonda
] cc: [EMAIL PROTECTED] 12/19/2002 11:20 Subject: Re: Passing array to a function AM

Re: Passing array to a function

2002-12-19 Thread Paul Johnson
On Thu, Dec 19, 2002 at 03:45:56PM -, 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 mi

Re: Passing array to a function

2002-12-19 Thread John W. Krahn
Satya Devarakonda wrote: > > Hi, Hello, > How can I pass an array to a function and get values back in it??? Here > are excerpts from my code. > > sub getTimeInfo > { > my $sec = 0; > my $min = 0; > my $hour = 0; > my $day = 0; > my $mon

Re: Passing array to a function

2002-12-19 Thread Rob Dixon
- Original Message - From: "Paul Johnson" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: "Rob Dixon" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, December 19, 2002 7:19 PM Subject: Re: Passing array to a function > On Thu, De

Re: Passing array to a function

2002-12-19 Thread Satya_Devarakonda
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

Re: Passing array to a function

2002-12-20 Thread Rob Richardson
> - Original Message - > From: "Rob Richardson" <[EMAIL PROTECTED]> > To: "Rob Dixon" <[EMAIL PROTECTED]> > Sent: Friday, December 20, 2002 1:30 PM > Subject: Re: Passing array to a function > > > > Rob, > > > > OK, I se

Re: Passing array to a function

2002-12-20 Thread Rob Dixon
"Rob Richardson" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Rob, > > I will take your word that "$a = (3, 2, 1);" returns 1. I think I was > thinking of "$a = [3, 2, 1];", in which an anonymous array would be > created and $a would return 3, the number

Re: Passing array to a function

2002-12-20 Thread John W. Krahn
Rob Richardson wrote: > > I will take your word that "$a = (3, 2, 1);" returns 1. I think I was > thinking of "$a = [3, 2, 1];", in which an anonymous array would be > created and $a would return 3, the number of elements in the array. > > NOT!!! > > The above is what I was going to say when I

Re: Passing array to a function

2002-12-20 Thread Satya_Devarakonda
L PROTECTED] To: [EMAIL PROTECTED] am.co.uk>cc: Subje

Re: Closure definition (was: Passing array to a function)

2002-12-19 Thread wiggins
On Thu, 19 Dec 2002 17:44:22 +0100, "Jenda Krynicky" <[EMAIL PROTECTED]> wrote: > From: [EMAIL PROTECTED] > > > > On Thu, 19 Dec 2002 11:04:27 -0500, [EMAIL PROTECTED] > > wrote: > > > But is it not

Re: Closure definition (was: Passing array to a function)

2002-12-20 Thread Jenda Krynicky
From: [EMAIL PROTECTED] > > On Thu, 19 Dec 2002 17:44:22 +0100, "Jenda Krynicky" > <[EMAIL PROTECTED]> wrote: > > > This is: > > sub createClosure { > > my $x = shift; > > return sub { print $x++,"\n" } > > } > > > >