Nicely display a reference to something (hash, array or scalar) in Perl

Below is a little function to display a reference to mainly a hash, array or scalar in Perl:


use strict;
use warnings;

our $indentationString = "    ";

sub recursive_ref_string
{ Continue reading 

Python Singleton


class Singleton( object ):
        instance = None
        def __new__( className, *args, **kargs):
                print 'Getting %s instance' % className.__name__
                if className.instance is None:
                        print 'Creating new %s object' % className.__name__
                        className.instance = object.__new__( className, *args, **kargs );
                return className.instance
 Continue reading