-----Original Message----- >From: Mihir Kamdar <[EMAIL PROTECTED]> >Sent: Aug 2, 2007 2:26 AM >To: beginners <beginners@perl.org> >Subject: Opening a directory for writing > >Hi, > >I am reading all the files in a directory through readdir....Now after >reading each of the file and processing it, I want to write their output one >by one to a different >directory. > >Please suggest on how can this be done? >
Hi, you may follow some logic like below: while (my $file = readdir DIR) { next if $file =~ /^\.+$/; my @handled_result = your_handling_routine($file); open OUT,">","/other/path/$file.out" or die $!; print OUT @handled_result; close OUT; } you just open a file in other directory with write mode and then print to this file handle. see: perldoc -f open perldoc -f print -- http://home.arcor.de/jeffpang/ http://home.earthlink.net/~pangj/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/