DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Perl (http://www.daniweb.com/forums/forum112.html)
-   -   Pointers for PERL (http://www.daniweb.com/forums/thread158473.html)

it2051229 Nov 20th, 2008 3:19 am
Pointers for PERL
 
In C we have what we call dangling pointers where if a pointer is pointing to something else and if that something else is deallocated or removed from memory then the pointer that is pointing to that something else is now a dangling pointer. I've been learning the basics of perl but never get to touch pointers. Are there possibilities in PERL to have a dangling pointer? or can we even create pointers in PERL? i'm doing console apps and not for the web.

ithelp Nov 20th, 2008 5:13 am
Re: Pointers for PERL
 
In perl you have got reference , it cannot be dangling. The memory management is taken care by the langauge.

KevinADC Nov 20th, 2008 12:42 pm
Re: Pointers for PERL
 
Yes, with perl this should not be a problem although it does help to properly declare variables within the intended scope of their use using "my", "our", or "local" when and where appropriate.

As ithelp has said, in perl they are called references. They are mostly used to create complex data strucutes, like a multi-dimensional array or hash, but can be used for other things.

http://perldoc.perl.org/functions/ref.html


All times are GMT -4. The time now is 7:22 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC