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);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Someone please verify this.
by Zaxo (Archbishop) on Jul 10, 2007 at 03:58 UTC | |
Re: Someone please verify this.
by GrandFather (Saint) on Jul 10, 2007 at 04:35 UTC | |
Re: Someone please verify this.
by Hercynium (Hermit) on Jul 10, 2007 at 03:54 UTC | |
by GrandFather (Saint) on Jul 10, 2007 at 04:40 UTC | |
Re: Someone please verify this.
by rob_au (Abbot) on Jul 10, 2007 at 04:25 UTC | |
Re: Someone please verify this. (Verilog::VCD)
by toolic (Bishop) on Jul 10, 2007 at 13:52 UTC | |
by Anonymous Monk on Jan 22, 2012 at 05:21 UTC | |
by toolic (Bishop) on Jan 22, 2012 at 13:55 UTC | |
by sarodeoa (Initiate) on Jan 23, 2012 at 00:07 UTC | |
by vijayvithal (Novice) on May 19, 2017 at 17:19 UTC |
Back to
Seekers of Perl Wisdom