use strict; use warnings; open( NAMES, "; close(NAMES); print "list = @list\n"; for my $name (@list) { chomp($name); open(OUT, ">$name.txt") or die $!; print OUT "hello"; close(OUT); }