in reply to Re^4: Declaring and checking content of variables with consecutive names
in thread Declaring and checking content of variables with consecutive names
I understand, however, this is strongly discouraged in the Perl community.
If I've understood your description correctly, there should be no discouragement at all to this. I assume you mean:
my $fileroot = 'foo'; for my $j (0..999) { my $filename = $fileroot . $j; open (my $out, '>', $filename) or die "Cannot open file $filename fo +r writing: $!"; print $out "Hello world!\n"; close $out; }
which seems a perfectly feasible way of achieving 1000 consecutively numbered files in one directory.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: Declaring and checking content of variables with consecutive names
by rflesch (Novice) on Sep 29, 2016 at 10:12 UTC | |
by hippo (Archbishop) on Sep 29, 2016 at 10:41 UTC | |
by choroba (Cardinal) on Sep 29, 2016 at 16:37 UTC |