On Thu, Jun 19, 2003 at 02:25:05PM +0800, Boon Chong Ang wrote:
> Now, I want to use perl to change the syntax from module add
> till endmodule and module clt till endmodule only. The rest
> I want it to remain the same. What is the approach I should
> use to accomplish this tasks?
There are a couple of FAQs that might help:
$ perldoc -q "change one line"
$ perldoc -q "between two patterns"
As a rough outline -->
#!/usr/bin/perl
use strict;
use warnings;
@ARGV = $filename; # for "in-place" editing
$^I = '.bak'; # file extension for backups
while (<>) {
# skip lines outside these patterns:
next unless /^module (add|clt)/../^endmodule/;
# interesting stuff goes here:
rearrange_those_dots();
}
And if you give us a more specific problem description we MAY
be able to give you more specific advice. :-)
--
Steve
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]