use diagnostics; use strict; open (FILE, "c:\\my\\dir\\src.file.txt") || die "failed to open src file"; while (){ my $var_a = $_; my $var_b = "_INDEX"; my $var_c = $_; $var_a =~ s/(^[A-Z]{4})(.*)/$1/o; $comb = $var_a . $var_b; open ($comb, "c:\\my\\dest\\dir\\" . $comb . "found.txt") || die "failure to create" . $comb; print $comb $var_c . "content detail for file found\n"; } close FILE; #_## do some other functions that add more information to file. close $comb. #### WORKS: open ('$comb', "c:\\my\\dest\\dir\\" . $comb . "found.txt") Unable to figure out the print function. ERROR: print $comb $var_c . "content detail for file found\n";