if(widgetStylesPrinted != true) {document.write('');}var widgetStylesPrinted = true;var content = '
Untitled
perl
  1. #! /usr/local/bin/perl
  2.  
  3. #tree .. カレントディレクトリ以降のファイルリストを作成
  4.  
  5. $dir = `pwd`;
  6. print $dir;
  7. $dep =1;
  8. &dirproc($dep);
  9.  
  10. sub dirproc {
  11. my($dep) = @_;
  12. my(@files,$file);
  13. @files = sort(glob("*"));
  14. foreach $file(@files) {
  15. if (-f $file){
  16. for ($i = 1; $i <= $dep; $i++){
  17. print "|\\t";
  18. }
  19. print $file."\\n";
  20. }
  21. }
  22.  
  23. foreach $file(@files) {
  24. if (-d $file){
  25. for ($i = 1; $i <= $dep; $i++){
  26. print "|\\t";
  27. }
  28. print $file."\\n";
  29. ++$dep;
  30. chdir($file);
  31. &dirproc($dep);
  32. chdir("..") or die "abend. don't ask me why";
  33. --$dep;
  34. }
  35. }
  36. }
';document.write(content);