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: Frequently Asked Questions:
Is it unsafe to return a pointer to local data?

 



Jasmine
Administrator

Jan 19, 2001, 12:08 PM

Post #1 of 1 (1830 views)
Is it unsafe to return a pointer to local data? Can't Post

(From the Perl FAQ)

Is it unsafe to return a pointer to local data?

No, Perl's garbage collection system takes care of this.

Code
    sub makeone { 
my @a = ( 1 .. 10 );
return \@a;
}

for $i ( 1 .. 10 ) {
push @many, makeone();
}

print $many[4][5], "\n";

print "@many\n";


 
 


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

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