in reply to Sequential names
Most of this code can be replaced by $filename++ since $filename= "xyz"; $filename++; leaves $filename set to "xza".