内のファイルを探してsubdirectories、ディレクトリからすべてを反復処理する手順を実装しようとしています。root.xmlPerl
sub getXMLFiles {
    my $current_dir = $_[ 0 ];
    opendir my $dir, $current_dir or die "Cannot open directory: $!\n";
    my @files = grep /\.xml$/i, readdir $dir;
    closedir $dir;
    return @files;
}
sub iterateDir {
    my $current_dir = $_[ 0 ];
    finddepth( \&wanted, $current_dir );
    sub wanted{ print getXMLFiles }
}
#########################################################
#                                                       #
# define the main subroutine.                           #
# first, it figures from where it is being ran          #
# then recursively iterates over all the subdirectories #
# looking for .xml files to be reformatted              #
#                                                       #
#########################################################
sub main(){
    #
    # get the current directory in which is the 
    # program running on
    #
    my $current_dir = getcwd;
    iterateDir( $current_dir );
}
#########################################################
#                                                       #
# call the main function of the program                 #
#                                                       #
#########################################################
main();
私はあまり詳しくありませんPerl。この手順は、ファイルをフィルタリングして返すsub iterateDir間、サブディレクトリを反復処理することになっています。これらのファイルを解析に使用します。そのため、ディレクトリからすべてのファイルを見つけようとしています。ただし、内部の手順を使用してtoに送信する方法がわかりません。どうすればそれを達成できますか?getXMLFiles.xml.xml.xmlrootsub wantediterateDirdirpathgetXMLFiles