Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: nondestructive way to look at a character in a string

by kcott (Archbishop)
on Jan 16, 2022 at 11:02 UTC ( [id://11140500]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -E '
        my @x = qw{ABC DEF BXB};
    ...
    DEF: NO
    BXB: NO
    BXB: NO
    
  2. or download this
    #!/usr/bin/env perl
    
    ...
        index => sub { $i == index($_, $c, $i) ? 1 : 0 for @x },
        substr => sub { $c eq substr($_, $i, 1) ? 1 : 0 for @x },
    };
    
  3. or download this
                Rate substr  index
    substr 3981142/s     --   -46%
    index  7383385/s    85%     --
    

Log In?
Username:
Password:

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

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

    No recent polls found