Skip to content

Instantly share code, notes, and snippets.

@mattjmorrison
Created February 13, 2010 03:09
Show Gist options
  • Save mattjmorrison/303222 to your computer and use it in GitHub Desktop.
Save mattjmorrison/303222 to your computer and use it in GitHub Desktop.
sub _t{if(uc(ref($_[1]))=~m/^HASH/g){$s.='{';for(keys%{$_[1]}){$s.=$_.'=>';$_[0]->_t($_[1]->{$_});$s.=',';}$s.='},';}elsif(uc(ref($_[1]))=~m/^ARRAY/g){$s.='[';for(@{$_[1]}){$_[0]->_t($_);$s.=',';}$s.='],';}elsif(ref($_[1])){$s.='bless(';$_[0]->_t(scalar{%{$_[1]}});$s.=ref($_[1]).');';}else{$s.=qq|'$_[1]'|;}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment