in reply to Use of uninitialized value $_ in pattern match (m//)

Hi,

open $vf, '>>', $b
This opens in the file in append mode, so when you do
while (<$vf>) { if($_ =~ /module entity\;/)
(after adding the while (<$FH>) { ... } construct as suggested by syphilis), there are no lines read; the loop is never entered.

See open.

You should open your file in read/write mode, if the intent of your program is indeed as it appears.

open $vf, '+<', $b or die $!;

(Note: I can't make sense of what you are trying to accomplish. You read in a path from the user and then repeatedly print that path to a verilog file, once for each existing line in the file that matches a certain string. Is that really your intent?)

Hope this helps!

update: added link to doc and example


The way forward always starts with a minimal test.