On Mon, Aug 18, 2014 at 06:07:59AM -0700, John SJ Anderson wrote:
On Mon, Aug 18, 2014 at 1:38 AM, Paul Johnson wrote:
> On Mon, Aug 18, 2014 at 04:17:53PM +0800, Ken Peng wrote:
>> which one is the better way to return the list content? And if the
>> method is an instance method?
To expand
On Wed, Sep 10, 2014 at 4:18 AM, Rob Dixon wrote:
> On 09/09/2014 02:20, Ken Peng wrote:
>>
>>
>>> The second option creates the same array and populates it, but then
>>> copies it to another anonymous array, deletes the first array, and
>>> returns a reference to the copy.
>>
>>
>> Since this is
On 09/09/2014 02:20, Ken Peng wrote:
The second option creates the same array and populates it, but then
copies it to another anonymous array, deletes the first array, and
returns a reference to the copy.
Since this is a shadow copy, I don't think the first array will be
deleted completely. I
Since this is a shadow copy, I don't think the first array will be
deleted completely. Isn't it?
The second option creates the same array and populates it, but then
copies it to another anonymous array, deletes the first array, and
returns a reference to the copy.
--
To unsubscribe, e-mail:
On 18/08/2014 09:17, Ken Peng wrote:
sub myfunc {
my @x=(1,2,3);
return \@x;
}
# or,
sub myfunc {
my @x=(1,2,3);
return [@x];
}
which one is the better way to return the list content? And if the
method is an instance method?
The first version of the subroutine is the best choice
On Tue, 09 Sep 2014 00:13:13 +0200
lee wrote:
> Shawn H Corey writes:
>
> > On Mon, 18 Aug 2014 16:17:53 +0800
> > Ken Peng wrote:
> >
> >> sub myfunc {
> >> my @x=(1,2,3);
> >> return \@x;
> >> }
> >>
> >> # or,
> >>
> >> sub myfunc {
> >> my @x=(1,2,3);
> >> return [@x];
> >> }
> >
On Sep 8, 2014, at 3:13 PM, lee wrote:
> Shawn H Corey writes:
>
>> On Mon, 18 Aug 2014 16:17:53 +0800
>> Ken Peng wrote:
>>
>>> sub myfunc {
>>> my @x=(1,2,3);
>>> return \@x;
>>> }
>>>
>>> # or,
>>>
>>> sub myfunc {
>>> my @x=(1,2,3);
>>> return [@x];
>>> }
>>
>> # or
>>
>> sub myfu
Shawn H Corey writes:
> On Mon, 18 Aug 2014 16:17:53 +0800
> Ken Peng wrote:
>
>> sub myfunc {
>> my @x=(1,2,3);
>> return \@x;
>> }
>>
>> # or,
>>
>> sub myfunc {
>> my @x=(1,2,3);
>> return [@x];
>> }
>
> # or
>
> sub myfunc {
> return [ 1, 2, 3 ];
> }
Is there a difference to
su
On Mon, Aug 18, 2014 at 1:38 AM, Paul Johnson wrote:
> On Mon, Aug 18, 2014 at 04:17:53PM +0800, Ken Peng wrote:
>> which one is the better way to return the list content? And if the
>> method is an instance method?
>
> Functionally, the two are identical. The first is returning a reference
> to
On Mon, 18 Aug 2014 16:17:53 +0800
Ken Peng wrote:
> sub myfunc {
> my @x=(1,2,3);
> return \@x;
> }
>
> # or,
>
> sub myfunc {
> my @x=(1,2,3);
> return [@x];
> }
# or
sub myfunc {
return [ 1, 2, 3 ];
}
--
Don't stop where the ink does.
Shawn
--
To unsubscribe, e-mail:
On Mon, Aug 18, 2014 at 04:17:53PM +0800, Ken Peng wrote:
> Hello,
>
> sub myfunc {
> my @x=(1,2,3);
> return \@x;
> }
>
> # or,
>
> sub myfunc {
> my @x=(1,2,3);
> return [@x];
> }
>
> which one is the better way to return the list content? And if the
> method is an instance method?
F
11 matches
Mail list logo