in reply to Text switching
If you've got a list of valid apt numbers probably the most efficient thing to do would be create a hash and use that to validate (although declaring it with a comma separated list likewise is a minor kludge, but you get the idea):
my %valid_apt_numbers; for my $unit ( split( /,/, q{1001,1002,...YADDAYADDA...,2505} ) ) { $valid_apt_numbers{ $unit } = 1; } if( exists $valid_apt_numbers{ $digits_4 } ) { $text =~ s{\b($digits_4)\b}{<a href=YADDAYADDA</a>}xmsg; }
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Text switching
by Bod (Parson) on Sep 13, 2022 at 15:25 UTC | |
Re^2: Text switching
by AnomalousMonk (Archbishop) on Sep 14, 2022 at 05:38 UTC | |
by Fletch (Bishop) on Sep 14, 2022 at 07:01 UTC | |
by AnomalousMonk (Archbishop) on Sep 14, 2022 at 08:33 UTC | |
Re^2: Text switching
by htmanning (Friar) on Sep 13, 2022 at 02:05 UTC |