in reply to requires explicit package name
In this case, your problem is here:
The scope of the first $name ends at the end of the block that it's in. The $name used in the next statement is a different variable. That's clearly not what you intend. The fix is to declare my $name; higher up in the script.... { my $name = $&; } my $outfile = "outfile[$name].txt";
|
|---|