#!/usr/bin/perl -w use strict; my $i = 1; $i++ while -f "file_$i.dat"; open OUTFILE, "file_$i.dat";