Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: match two elements from an array in a row

by dogz007 (Scribe)
on Aug 16, 2007 at 22:25 UTC ( #633186=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use List::Util qw(reduce);
    ...
              $index++;
              $b;
           } @data;
    
  2. or download this
    match 81 starting at index 6
    match 82 starting at index 22
    
  3. or download this
    for my $i (0 .. $#data) {
        if ( $data[$i] eq $data[$i+1] && $data[$i] =~ m/81|82/) {
            print "match $data[$i] starting at index $i\n";
        }
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://633186]
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 2021-01-21 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?