#!/usr/bin/perl $xml = &tree($ENV{'QUERY_STRING'}); print < var mystring = "$xml"; alert(mystring); EOF sub tree { local($dir) = $_[0]; local(@files); local($ret) = ""; return unless(-d $dir); local(@path) = split("/",$dir); $ret .= ""; opendir(DIR,$dir); foreach(readdir(DIR)) { # next if(substr($_,0,1) eq "."); next if($_ eq "." || $_ eq ".."); next if(-l "$dir/$_"); push(@files,"$dir/$_"); } closedir(DIR); foreach(sort(@files)) { if(-f $_) { local($file) = $_; local(@path) = split("/",$file); $ret .= ""; } elsif(-d $_) { $ret .= &tree($_); } } $ret .= ""; return $ret; }