in reply to Updating file name

You can use Perl's concatenation (dot) operator to combine strings:

for(1..2) { my $filename = $file . "$_.dat"; }

Update: s/j/_/;