Re: Opening a directory for writing
- From: pangj@xxxxxxxxxxxxx (Jeff Pang)
- Date: Thu, 2 Aug 2007 02:39:53 -0400 (EDT)
-----Original Message-----
From: Mihir Kamdar <kamdarmihir06@xxxxxxxxx>
Sent: Aug 2, 2007 2:26 AM
To: beginners <beginners@xxxxxxxx>
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/
.
- Follow-Ups:
- Re: Opening a directory for writing
- From: Dr.Ruud
- Re: Opening a directory for writing
- Prev by Date: Re: ASCII::Plot::Scatter namespace
- Next by Date: Re: Opening a directory for writing
- Previous by thread: Re: Opening a directory for writing
- Next by thread: Re: Opening a directory for writing
- Index(es):
Relevant Pages
|