bagu has asked for the wisdom of the Perl Monks concerning the following question:
Now, I know I can't do this when using strict, but, how else? I want to use strict, but is there no way of constructing the filehandle on the fly so I can predict what the filehandle will be called when using it later? Am I making sense at all?use strict; my %monitored_files; %monitored_files = ( "messages" => "/var/log/messages" ); my $key; foreach $key (keys (%monitored_files)) { open ($key, $monitored_files{$key}) or die " ! Could not open $key +: $!"; print(" * $key opened\n"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Reading multiple files at the same time
by l2kashe (Deacon) on Dec 08, 2003 at 23:41 UTC | |
|
Re: Reading multiple files at the same time
by Paladin (Vicar) on Dec 08, 2003 at 22:34 UTC | |
by waswas-fng (Curate) on Dec 08, 2003 at 22:38 UTC | |
|
Re: Reading multiple files at the same time
by waswas-fng (Curate) on Dec 08, 2003 at 22:35 UTC | |
|
Re: Reading multiple files at the same time
by Zaxo (Archbishop) on Dec 09, 2003 at 08:47 UTC |