in reply to updating multiple text files

And that is why people recommend using lexical filehandles. It is sad that global ones are considered 'standard' by some.
use strict; use warnings; use autodie; open my $users, '<', 'users.txt'; my @files; for my $file ( qw( file1 file2 file3 ) ) { open my $fh, '>>', $file; push @files, $fh; } while ( my $line = <$users> ) { print $_ $line for @files; }

Replies are listed 'Best First'.
Re^2: updating multiple text files
by marinersk (Priest) on Mar 10, 2015 at 21:25 UTC

    It was what was taught by firstPerlers, which makes it a defacto standard. (I note here that this does not prevent it from being sad; it merely shows a valid reason why it might be seen as a standard by some).

    If memory serves, one used to have to turn off strictures in order to not use global handles, a workaround for which was given in one of my earliest PerlMonks SoPW posts. It was there that I learned stricture control was lexically scoped. : -)

    In the end, some folks will move forward with new features of a language and others will not; it is driven by needs and values.

    For example, I still use the &subName(); form for calling non-object-oriented subroutines. There are many who do not appreciate that calling sequence, as it is archaic v4 syntax; but it adds a clarity for these old eyes, and barring a coding standard to the contrary, will continue -- sad or not -- in this corner of the world.

    :-)