in reply to Re^3: Error coming while using Use Strict
in thread Error coming while using Use Strict

hi,

I am creating five file .So i expect unique file handler for each file.That program is running without using strict

  • Comment on Re^4: Error coming while using Use Strict

Replies are listed 'Best First'.
Re^5: Error coming while using Use Strict
by choroba (Cardinal) on Oct 13, 2011 at 10:30 UTC
    No, you are creating one file, so you need one file handle. Then, you are creating one file, so you again need one file handle. Then, you are creating one file, so you again need one file handle. Then, you are creating one file, so you again need one file handle. Then, you are creating one file, so you again need one file handle.
    Which makes it one file handle in total.
Re^5: Error coming while using Use Strict
by jethro (Monsignor) on Oct 13, 2011 at 14:02 UTC

    Your are creating five files, but one after another. So you can reuse one filehandle for all five files. Only if you had more than one file open at the same time(!) would you need more than one filehandle. In that case use this:

    my @key; for(my $i=0;$i<5;$i++) { $output_file=$key[$i].$output_file; open($key[$i],'>:utf8',"$output_file"); my $f= $key[$i]; print $f $start."\n"; ...