Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, here is my code in that i had merged the files and saved to a new file , and guide me how to create a ini file and how to list the files using perl code


Quote:

my $samplefolder = $ARGV[0];

opendir (DIR,"$samplefolder") || die ("Can't open the input folder for reading");
my (@files) = grep/\.xml$/,readdir(DIR);
closedir(DIR);

my $mergestr;

for my $file (@files){
#$mergestr .= $file."\n";
open (IN,"$samplefolder\\$file") || die ("Can't open the input file for reading");
undef $/;
my $str = <in>;
close (IN);

$mergestr .= "<merge_$file>\n".$str."\n\n\n";
}

open (OUT,">$samplefolder\.xml")||die ("Can't open the output file for writing");
print OUT $mergestr;
close (OUT);

open(DIR, ">>samplefolder")|| die "$!"; #OPEN FILE FOR WRITING
@samplefolder=@field;
printf $samplefolder;
Posted
Comments
Sergey Alexandrovich Kryukov 18-Nov-11 14:32pm    
Perl... (sigh).
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900