On Wed, Jul 20, 2011 at 11:57:18PM +0200, Johan Vromans wrote:
> The very first piece of code from the tutorial should be something
> similar to:
>
> In general, the way to open a file, read it contents, and write it to
> another file goes like this:
>
> open( STDIN, '< :encoding(utf-8)', 'data.file' ) or die;
> open( STDOUT, '> :encoding(utf-8)', 'new.file' ) or die;
> while ( <> ) {
> # do something with contents
> print($_) or die;
> }
> close(STDOUT) or die;
> close(STDIN) or die;
Well, I don't think that the very first example should include reopening
STDIN/OUT, especially without mentioning the issues that that could
cause (what happens if "do something with contents" involves prompting
for input?). Otherwise, yes, I agree entirely.
-doy
Thread Previous
|
Thread Next