in reply to multiple-pass search?
use Tie::File; sub replace_serialnumbers_in_file($) { my @word = qw( zero one two three four five six seven eight nine ) +; my $filename = shift; my $serno = join '', map $word[$_], $filename =~ /(\d)/; # assumin +g no other digits in the filename tie my @lines, 'Tie::File', $filename or die; s/\\zerozerozero/\\$serno/g for @lines; }
You don't need multipass if you take the serial number from the filename.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: multiple-pass search?
by propellerhat (Novice) on Dec 09, 2021 at 22:39 UTC | |
by jdporter (Paladin) on Dec 10, 2021 at 01:57 UTC | |
by propellerhat (Novice) on Dec 10, 2021 at 02:18 UTC | |
by Fletch (Bishop) on Dec 10, 2021 at 13:54 UTC | |
by jdporter (Paladin) on Dec 10, 2021 at 16:11 UTC | |
by propellerhat (Novice) on Dec 10, 2021 at 18:39 UTC |