Posted by brian d foy on September 18, 2011
When you’re using code references heavily, you’re going to have a problem figuring out which one of them is having a problem. You define them in possibly several and far-flung parts of your program, but when it comes to using them, you don’t know which one you are using. You can’t really print its value [...]
Posted by brian d foy on May 30, 2010
References aren’t just for data structures, and many people overlook the benefit of references to simple scalars. With references to arrays and hashes you can keep those data structures in tact when you pass them to or return them from subroutines (Item 46: Pass references instead of copies). You don’t need to worry about scalar [...]
Posted by brian d foy on March 21, 2010
When you want to make a copy of a hash or an array, it’s not enough to merely assign it to a new variable name, at least in the general case: my @copy = @original; This is a bad habit that new Perl programmers pick up because they are only dealing with flat arrays: that [...]