in reply to Re: Re: File opening problems
in thread File opening problems

open needs a filename, not the content of the file to be. If you wouldn't give the file, how is Perl supposed to know which file to open?
my $file = "whatever"; open my $out, ">", $file or die "Failed to open $file: $!"; print $out @htmlLines; close $out or die "Failed to close $file: $!";

Abigail

Replies are listed 'Best First'.
Re: Re: File opening problems
by Tricky (Sexton) on Aug 19, 2003 at 13:24 UTC
    Just replaced the duff code with this:
    # Replacing original file with reformatted file! my @htmlFile = "@htmlLines"; open (OUTFILE, ">E:/Documents and Settings/Richard Lamb/My Documents/H +TML/test1InDocCSS.html") or die("Can't rewrite the HTML file.\n"); print (OUTFILE @htmlFile); close (INFILE); close (OUTFILE);
    It works! Fantastic!I opened the original html file on my hard-drive a +nd, hey-presto, no images or hyperlinks... Thanks a million Abigail, Richard
      my @htmlFile = "@htmlLines";

      Why? Does this have a point except using more memory than necessary?

      Abigail