Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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

by kcott (Archbishop)
on Jan 16, 2022 at 11:02 UTC ( #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? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2022-07-01 11:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (98 votes). Check out past polls.

    Notices?