http://www.perlmonks.org?node_id=557141

rjsaulakh has asked for the wisdom of the Perl Monks concerning the following question:

i have a large no of .htm files in a specified directory and i need to combine all this files into one .htm file i am trying with the following piece of code but it is not able to open the file . please help

#!/usr/bin/perl #use strict; use warnings ; opendir(DIR, "/home/rjs/perl/perlnut/") or die "cant open the specfied + directory $!"; my @file = readdir(DIR); #my $book = final.htm; open(OUT, ">book") or die "Can't create book: $! \n "; + foreach (sort @file) { local(*IN); open( IN, $_) or die "cant raman open $_ : $!\n "; print OUT while <IN>; close (IN); + }