# prompts the user for a filename, then logs all input lines # to that file, until a line consisting only of "." is seen. print "What is the name of the keylogging data file? "; my $file = <>; chomp $file; open LOG, "> $file" or die "error writing $file - $!"; while ( $line = <> and $line ne ".\n" ) { print LOG $line; } close LOG;
In reply to File I/O #2
by vroom
in thread File Input and Output Exercises
by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |