in reply to Re^2: foreach loop and creating files with "$_"
in thread foreach loop and creating files with "$_"

my $file = "file"; my $temp = "temp"; foreach (1..5){ open $file, '>', "$temp" . "$_"; print $file "THIS IS DATA"; }
or
my $file = "file"; my $temp = "temp"; foreach my $end (1..5) { open $file, '>', "$temp" . "$end"; print $file "THIS IS DATA"; }
(not tested)

Personal preference only...

...the majority is always wrong, and always the last to know about it...

Insanity: Doing the same thing over and over again and expecting different results...

A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is a facct

Replies are listed 'Best First'.
Re^4: foreach loop and creating files with "$_"
by toolic (Bishop) on Jul 22, 2014 at 13:41 UTC