in reply to How do I write to a file?

#!/usr/bin/perl use strict; use warnings; my $file = $ARGV[0]; my $line; open (FILE, "< $file"); while ($line = <FILE>) { chomp $line; printf("\n [$line]"); } close FILE;

Replies are listed 'Best First'.
Re: Answer: How do I write to a file?
by ajdelore (Pilgrim) on Aug 07, 2003 at 18:30 UTC

    Am I being dense here, or does this code read and print the file? The question asks how to write to the file.

    </ajdelore>