in reply to Problem with sub
There are a couple of problems which don't seem to directly relate to your question, but which might be the cause of the difficulty.
The way you describe it, you seem to be using a bunch of independent standalone scripts which may be subject to scoping problems with variables.
The code you show has problems with the scope of $victim, an inappropriate comparison in line 019, demolishment of the names.txt file in line 024, an undefined function 'Close', and no result checking in any system interaction.
A single open with:
is probably a better approach, particularly if file locking is needed.{ open my $foo, '+<', $filename or die $!; /$victim/ and last while <$foo>; print $foo $victim, $/ or die $!; }
After Compline,
Zaxo
|
|---|