Fathersuperior has asked for the wisdom of the Perl Monks concerning the following question:
The problem lies when the program is getting input from the user. If for some reason the program ends improperly all the input the user has entered will just dissappear.@colors = qw(pink yellow blue green); open(COLORS, ">>colors.txt"); foreach $color (@colors){ print COLORS "$color\n"; print "sending $color to File\n"; } close(COLORS); while (<STDIN>){ chomp; print COLORS $_; if ($_ eq "quit"){exit} }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how do I write directly to a file
by davorg (Chancellor) on Jun 07, 2001 at 17:26 UTC | |
|
Re: how do I write directly to a file
by mugwumpjism (Hermit) on Jun 07, 2001 at 19:31 UTC | |
by davorg (Chancellor) on Jun 07, 2001 at 19:37 UTC | |
|
Re: how do I write directly to a file
by azatoth (Curate) on Jun 07, 2001 at 17:18 UTC | |
|
Re: how do I write directly to a file
by bwana147 (Pilgrim) on Jun 07, 2001 at 19:42 UTC |