Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: String Comparison & Equivalence Challenge

by AnomalousMonk (Archbishop)
on Mar 15, 2021 at 04:28 UTC ( [id://11129643]=note: print w/replies, xml ) Need Help??


in reply to Re^2: String Comparison & Equivalence Challenge
in thread String Comparison & Equivalence Challenge

$ro->insert(end => join "", map s/^(\d\d)\d*/$1%/r . "\n", @matches[...] );
$ro->insert(end => join "", map { do { (my $s = $_ ) =~ s/^(\d\d)\d*/$1%/ . "\n"; $s }, @matches[...] });

Try:
    $ro->insert(end => join "", map { (my $r = $_) =~ s/^(\d\d)\d*/$1%/;  "$r\n"; } @matches[0 .. $bestcount - 1]);

Update:

... the s///r pragma.
NB: s///r is not a pragma. /r is a modifier (update: available from Perl version 5.14 on) of the s/// operator.


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^4: String Comparison & Equivalence Challenge
by Polyglot (Chaplain) on Mar 15, 2021 at 04:54 UTC

    Thank you very much! The script works with that adjustment. BTW, "pragma" is not even in my dictionary--so I'm not able to easily verify its usage. I guess I'm a bit vocabulary challenged today.

    Blessings,

    ~Polyglot~

      See pragma.


      Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found