CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
address of a array variable

 



jigneshjsoni
User

Jun 2, 2008, 2:33 PM

Post #1 of 3 (254 views)
address of a array variable Can't Post

what is meant by address of "array variable" ?

How can you get an addres of array variable ?


winfinit
User

Jun 2, 2008, 3:33 PM

Post #2 of 3 (253 views)
Re: [jigneshjsoni] address of a array variable [In reply to] Can't Post

hello, i think you are talking about a reference (it is not a data address of your memory, so it is not similar to & in C)

if you need to find/create a reference in perl you can do that with a "\"
below example will print a reference number and a content of an array.

winfinit:~ winfinit$ cat 4
#!/usr/bin/perl

@array = qw/1 2 3 4 5 6/;
$var = \@array;
print "Reference: $var\n";
for ($i=0;$i<=$#array;$i++)
{
print $var->[$i] . "\n";
}
winfinit:~ winfinit$ perl 4
Reference: ARRAY(0x801740)
1
2
3
4
5
6

read up on that article that i attached above it also talkes about how to get a typeglobs from a symbol table.


KevinR
Veteran


Jun 2, 2008, 3:51 PM

Post #3 of 3 (252 views)
Re: [jigneshjsoni] address of a array variable [In reply to] Can't Post

winfinit may have understood your question, but if not, please elaborate more. The "address" of an array variable is not something I have ever heard of. There is the index of an array variable 0, 1, 2 etc. Which is just its place in order in the list, 0 being the first position.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives