fork download
  1. #!/usr/bin/perl
  2.  
  3. arrPrint(t(3));
  4.  
  5. sub t{$r=[($t)=@_];$r=[$t,$r]while--$t>0;$r}
  6.  
  7. sub arrPrint {
  8. my ($c) = @_;
  9. for (@{$c}) {
  10. if (ref eq "ARRAY" ) {
  11. arrPrint($_);
  12. } else {
  13. print "(${_},";
  14. }
  15. }
  16. print ")";
  17. }
Success #stdin #stdout 0s 6000KB
stdin
Standard input is empty
stdout
(1,(2,(3,)))