Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Adjacent numbers

by Anonymous Monk
on Nov 20, 2015 at 07:45 UTC ( [id://1148203]=note: print w/replies, xml ) Need Help??


in reply to Adjacent numbers

It's almost a one-liner :)

#!/usr/bin/perl # http://perlmonks.org/?node_id=1148176 use strict; use warnings; my %used; print grep /_/ && !$used{$_}++, (join '', <DATA>) =~ /^(.*?(\d+)\n)(?=(.*?(\d+)\n))(??{1 != abs($2 - $4)&&'(*F)'})/gm; __DATA__ 2L_33 2L_34 3L_45 3L_87 X_202 X_203 X_204

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-03-29 06:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found