in reply to Search and replace
$line =~ s/input .*clk/output .*clk/g;
The first part of s/// is a regular expression but the second part is a string. It is essentially s/REGEX/STRING/. Since (in the first part of your task, which is the only part your code attempts to address) there are no complications, you can ignore the rest of the pattern and just do this:
$line =~ s/input/output/;
That should get you farther along. For the general case you would need to use capture groups.
🦛
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search and replace
by kulua (Initiate) on May 23, 2021 at 15:39 UTC | |
by hippo (Archbishop) on May 23, 2021 at 16:10 UTC | |
by tybalt89 (Monsignor) on May 23, 2021 at 16:09 UTC |