Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: experiencing slowness due to matching algorithm

by ovedpo15 (Pilgrim)
on Jan 09, 2023 at 10:36 UTC ( [id://11149449]=note: print w/replies, xml ) Need Help??


in reply to Re: experiencing slowness due to matching algorithm
in thread experiencing slowness due to matching algorithm

I will try it thanks!
The problem is that 0 == index $subpath, "$target/" is not quite the same as $subpath =~ /^$target\// because I want it to start with $target. Is there something similar to startswith of Python?

Replies are listed 'Best First'.
Re^3: experiencing slowness due to matching algorithm
by hippo (Bishop) on Jan 09, 2023 at 11:28 UTC

    Please provide a value each for $subpath and $target where 0 == index $subpath, "$target/" is true and where $subpath does not start with $target.

    use strict; use warnings; use Test::More; my @tests = ( { subpath => 'foo/bar', target => 'bar' }, { subpath => 'foo/bar', target => 'ba' }, { subpath => 'foo/bar', target => 'oo' }, ); plan tests => scalar @tests; for my $t (@tests) { isnt index ($t->{subpath}, "$t->{target}/"), 0, "False, as expecte +d" }

    🦛

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-03-28 13:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found