my @txt = glob('*.txt'); my @sql = @txt; s~\.txt$~.sql~ for @txt;