http://qs321.pair.com?node_id=625753

ksangam has asked for the wisdom of the Perl Monks concerning the following question:

Hi , I am very new to Perl, and I have written a small snippet that will read a file and should replace the pattern matched lines in the file and should print the changed file. Somebody, please tell me if my approach is right.
#!/usr/bin/perl $input_file = "dump.vcd"; open (INPUT, "$input_file"); while ($efile = <INPUT>) { for ($i = 0; $i <$#efile; $i++) { $efile[$i] =~ s/\$var\w \d+ ([!,\#,\",\$,\%,&]) (\w) \$end/\$v +ar $1 $2/ } print "$efile"; } close (INPUT);