How can I create a new file using a variable value as the name in Perl?

Posted by user295384 on Stack Overflow See other posts from Stack Overflow or by user295384
Published on 2010-03-17T05:24:34Z Indexed on 2010/03/17 14:41 UTC
Read the original article Hit count: 122

Filed under:

Eg:

$variable = "10000";
for($i=0; $i<3;$i++)
{
   $variable++;
   $file = $variable."."."txt";
   open output,'>$file' or die "Can't open the output file!"; 
}

This doesn't work. Please suggest a new way.

© Stack Overflow or respective owner

Related posts about perl