#!/usr/bin/perl use strict; use warnings; my @list = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z); foreach my $f(@list){ foreach my $s(@list){ my $fn = $f.$s; my $new_fn = '$'.$fn; open($new_fn, ">", "Extraction_$fn.txt") or die $!; } }