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
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
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
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
[ 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
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:
>
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
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
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
;;
@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&
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
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
12 matches
Mail list logo