All the files are automaticly closed when the perl program ends. Teddy
----- Original Message ----- From: "Dan Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, December 05, 2004 1:25 AM Subject: Re: Getting the dir structure On Thu, 2004-12-02 at 00:13 -0800, Mr M senthil kumar wrote: > > <SNIP> > > I have a file with thousands of line like : > > /abc/def/ijk/test.txt > > /pqr/lmn/test1.t > > I want to get the directory where the files test.txt and test1.txt are > > lying. > </SNIP> > > Hi, > You can try the following: > > #!/usr/bin/perl > open (IN,"<input_file") || die "Cannot open file: $!"; > open (OUT,">output_file") || die "Cannot send the output: $!"; I see this a lot. One thing that immediately occurs to me is that if opening IN succeeds but opening OUT fails, the program dies without closing IN. Is this acceptable code in the Perl world or should the code close all open files before dieing? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>