Google News
logo
Perl - Interview Questions
What is circular reference?
A circular reference occurs when two references contain a reference to each other. You have to be careful while creating references otherwise a circular reference can lead to memory leaks. Following is an example :
#!/usr/bin/perl
my $foo = 100;
$foo = \$foo;
 
print "Value of foo is : ", $$foo, "\n";
When above program is executed, it produces the following result :
Value of foo is : REF(0x9aae38)
Advertisement