Getting size of array parameter passed as a reference - preCharge Forums
It shows that you are unregistered. Please register with us by clicking Here
preCharge Forums


Nav Green LeftNav Right
preCharge Forums > Website Design & Development > Programming > Perl » Getting size of array parameter passed as a reference


Reply
Tcat Right
 
LinkBack Thread Tools Display Modes Tcat Right
Old 07-12-2006   #1 (permalink)
aaron
Junior Member
 
Join Date: Jul 2006
Age: 52
Posts: 24
Default Getting size of array parameter passed as a reference

Hi,

How can I obtain the size of an array that was passed as a reference.

ex:

&something(\@v1,\@v2);

sub something{
my($arr1,$arr2)=@_;

#get size of arr1?
}

I know I can loop through all the items by setting up a foreach(@$arr) but the regular old $# doesn't seem to work.

I also don't want to make a copy of this as an array, I want to keep it as a reference.

Thanks!
Aaron
aaron is offline   Reply With Quote


Old 07-23-2006   #2 (permalink)
Ankita
Member
 
Join Date: Jul 2006
Age: 25
Posts: 53
Thumbs up Re: Getting size of array parameter passed as a reference

The way you would have done with any other array

my $count = @{$arr1};
print $count;

This should work:)
Ankita is offline   Reply With Quote

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking own sites for reference? jordan PPC Search Engines 1 10-11-2006 05:15 AM
What's the difference between the System.Array.CopyTo() and System.Array.Clone()? agaba175 .NET 0 08-01-2006 05:15 PM
How to hide characters in parameter forms(To hide password) austin Site and Server Administration 0 07-29-2006 03:53 PM
Designer data export and obsolete OPTIMIZER_GOAL parameter dat adm zachary Programming 0 07-29-2006 03:45 PM
Size down? sneak123 Forum Management 6 01-07-2006 07:08 PM


footer left
All times are GMT. The time now is 12:50 AM.

DISCLAIMER: preCharge Risk Management is not responsible for any opinions, advice or comments expressed on the preCharge Community Forums.
preCharge® is a registered trademark of preCharge Risk Management | chargeback protection | Merchant Account Blog

Powered by vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC6

MPAA | Credit Report | Loans | Adult ADHD | Israel

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49