Current location: Hot Scripts Forums » Programming Languages » Perl » variable declaration


variable declaration

Reply
  #1 (permalink)  
Old 01-16-04, 11:25 AM
gmadhukarreddy gmadhukarreddy is offline
Newbie Coder
 
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
variable declaration

I want to declare and use 100 hashes like
a1,a2,a3,a4,a5,a6,......so on

so instead of declaring like
my (%a1,%a2,%a3,....);

is there anything possible like

for($i=1;$i<100;$i++)
{
my %a . "$i";
}

or

for($i=1;$i<100;$i++)
{
my %{a }$i;
}

please give the correct syntax, if any. and how to use it subsequently while accessing.......thanx
Reply With Quote
  #2 (permalink)  
Old 01-16-04, 02:01 PM
YUPAPA's Avatar
YUPAPA YUPAPA is offline
Newbie Coder
 
Join Date: Sep 2003
Location: Antarctica
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Code:
for $i (1..100) {
        my %{'a'.$i}    =       ();
}
__________________
YuPaPa.CoM is my home ~
Reply With Quote
Reply

Bookmarks


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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
dyanamic list box based on a variable solovaz JavaScript 0 01-16-04 03:02 AM
how to read a web page content to a variable? wings01234 JavaScript 4 01-13-04 08:27 AM
cannot send variable to new page (code included) brucewestfall Script Requests 2 12-18-03 11:32 PM
Call a variable name dynamically Kenrette ASP 2 11-12-03 09:48 AM
get current file name as variable paulj000 PHP 16 07-24-03 06:37 PM


All times are GMT -5. The time now is 04:51 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.