Re: how to pass array and varaible

2004-11-08 Thread John W. Krahn
Gunnar Hjalmarsson wrote: John W. Krahn wrote: Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: Alright, but what is the reason for less time when you pass the ref? I always thought the perl optimizes by sending the ref even if you use a direct array. When you pass an array, Perl *copies* the array e

Re: how to pass array and varaible

2004-11-08 Thread Gunnar Hjalmarsson
John W. Krahn wrote: Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: Alright, but what is the reason for less time when you pass the ref? I always thought the perl optimizes by sending the ref even if you use a direct array. When you pass an array, Perl *copies* the array elements to @_, so you get

Re: how to pass array and varaible

2004-11-08 Thread Ajey Kulkarni
John and Gunnar, Thanks a ton for clarification. ~A On Sun, 7 Nov 2004, John W. Krahn wrote: > Gunnar Hjalmarsson wrote: > > > > Ajey Kulkarni wrote: > >> > >> Alright, but what is the reason for less time when you pass the ref? > >> I always thought the perl optimizes by sending the ref even if

Re: how to pass array and varaible

2004-11-07 Thread John W. Krahn
Gunnar Hjalmarsson wrote: Ajey Kulkarni wrote: Alright, but what is the reason for less time when you pass the ref? I always thought the perl optimizes by sending the ref even if you use a direct array. When you pass an array, Perl *copies* the array elements to @_, so you get two instances of the

Re: how to pass array and varaible

2004-11-07 Thread Gunnar Hjalmarsson
[ Please bottom-post! ] Ajey Kulkarni wrote: Charles K. Clarkson wrote: Ajey Kulkarni <[EMAIL PROTECTED]> wrote: Make sure you pass var first, followed by array. There is no need to complicate with the array ref IMHO. Once you are used to working with references, they no longer complicate argument

RE: how to pass array and varaible

2004-11-07 Thread Ajey Kulkarni
Alright, but what is the reason for less time when you pass the ref? I always thought the perl optimizes by sending the ref even if you use a direct array. Where can i find more detailed info? regards ~A On Sun, 7 Nov 2004, Charles K. Clarkson wrote: > Ajey Kulkarni <[EMAIL PROTECTED]> wrote: >

RE: how to pass array and varaible

2004-11-07 Thread Charles K. Clarkson
Ajey Kulkarni <[EMAIL PROTECTED]> wrote: : Make sure you pass var first, followed by array. : There is no need to complicate with the array : ref IMHO. Once you are used to working with references, they no longer complicate argument passing. An array reference is always a single scalar while

Re: how to pass array and varaible

2004-11-06 Thread Ajey Kulkarni
ant as exactly > passed > > Anish > > - Original Message ----- > From: "Edward Wijaya" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Saturday, November 06, 2004 8:52 PM > Subject: Re: how t

RE: how to pass array and varaible

2004-11-06 Thread Charles K. Clarkson
Prasanna Kothari <[EMAIL PROTECTED]> wrote: : Pass reference to the array. Prosanna is correct. : #!/usr/bin/perl use strict; use warnings; : my @array=("First","second","third"); : my $menuStr="im"; : @tempArray=change([EMAIL PROTECTED],$menuStr); Should be my @tempAr

Re: how to pass array and varaible

2004-11-06 Thread Prasanna Kothari
;; @nwt=(23,234,543); return @nwt; } Result: The Varaible is Arrays is First second third im Element: 23 Element: 234 Element: 543 The varaible number is been appended to the arrya, I want as exactly passed Anish - Original Message - From: "Edward Wijaya&

Re: how to pass array and varaible

2004-11-05 Thread Anish Kumar K.
nded to the arrya, I want as exactly passed Anish - Original Message - From: "Edward Wijaya" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, November 06, 2004 8:52 PM Subject: Re: how to pass array and varaible > su

Re: how to pass array and varaible

2004-11-05 Thread Edward Wijaya
sub mysub { my ($var, @array) = @_; my @new_array = (); #do sth to @array or $var; return @new_array; } read - perldoc perlsub Regards, Edward WIJAYA On Sat, 6 Nov 2004 12:48:26 +0530, Anish Kumar K. <[EMAIL PROTECTED]> wrote: Hi I want to pass a array and and a varaibl