Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: multiple-pass search?

by hippo (Bishop)
on Dec 10, 2021 at 10:06 UTC ( [id://11139539]=note: print w/replies, xml ) Need Help??


in reply to Re^2: multiple-pass search?
in thread multiple-pass search?

Unfortunately you have not provided so much as a single line of Perl here. As such it is impossible to know at which point you are encountering a problem, let alone what that problem is.

Here is the sort of SSCCE you could have written:

use strict; use warnings; use Test::More tests => 3; my $filename = 'abstract-345.tex'; my $have = <<'EOT'; foo Here: \zerozerozero bar No. 345 baz EOT my $want = <<'EOT'; foo Here: \threefourfive bar No. 345 baz EOT my @digits = qw/zero one two three four five six seven eight nine/; my ($arabic) = $filename =~ /-([0-9]{3})\.tex/; (my $eng = $arabic) =~ s/([0-9])/$digits[$1]/g; $have =~ s/\\zerozerozero/\\$eng/; is $arabic, '345', 'Digits extracted'; is $eng, 'threefourfive', 'Converted to English'; is $have, $want, 'Replaced in text';

Now you can see how to perform these three operations. If that doesn't solve your problem you need to provide some runnable code which demonstrates the problem which you are having (ideally with a test such as shown here). In that way we will know what it is you are actually asking.

There's a detailed rationale at How to ask better questions using Test::More and sample data.


🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139539]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-26 01:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found