Just a real quick post to share some ‘fun’. I’ve noted already that I’m using perl in my work now. I’ve used it some in the past, but I couldn’t describe myself as an expert by any stretch of the imagination. I find myself regularly encountering things that require a quick refresh or even in depth investigation from one of the many fantastic sources out there. Today’s Problem de Jour is references.
What is a reference? All languages have variables to store information. Further all (that I have ever encountered) have a concept of references so that you can refer not to the data but to the spot in which the data resides. Fun stuff. It brings back fond memories of my early comp sci classes, which were in Pascal, and there were no end of jokes about the reference operator ‘^’, which is called ‘hat’. One uses it frequently with any sort of data structures and is more often than not found in tandem with the ‘.’ operator (‘dot’) to access values within a record, such as one that might be found in a linked list data structure. For young comp sci students, who are easily amused, this opens up a wide array of jokes in the vein of ‘^.this’ and ‘^.yourmom’. Programmer humor. It’s terrible, I know.
That all was a huge aside (funny, this was supposed to be a real quick post…) to the point that I’m finally really learning what is going on with references in Perl. As I’m reading along, I came upon the aforementioned word of the day, autovivification. It’s such a great (funny looking and sounding) word, that I had to share it. For those curious, here is what Wikipedia has to say regarding it:
Autovivification is a unique feature of the Perl programming language involving the dynamic creation of data structures. Autovivification is the automatic creation of a reference when an undefined value is dereferenced. In effect, this causes access to a nonexistent element of a hash (associative array) orarray to create both the hash or array, and all elements below the given index for the array.
Yeah, it’s mostly unintelligible to me as well. I know enough about it to know I don’t need to worry about it at this stage. Yet another thing that I know I don’t know. And that’s ok!



