Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: regex search valid only if registers n and n+1 are equal?

by Miguel (Friar)
on Jul 01, 2006 at 12:23 UTC ( #558752=note: print w/ replies, xml ) Need Help??


in reply to regex search valid only if registers n and n+1 are equal?

Just another way:
UPDATE: Another 3 ways:

#!/usr/bin/perl use strict; use warnings; while (<DATA>) { # 1 # my @arr = split; # print if $arr[1] != $arr[3]; # 2 print if sub { $_[1] != $_[3] }->(split); } # 3 # while (@_ = <DATA> =~ /(\w+)\s+/g) {print "@_\n" if $_[1] != $_[3]} __DATA__ foo 1000 bar 1000 foo 1000 bar 500
Prints:
foo 1000 bar 500


Comment on Re: regex search valid only if registers n and n+1 are equal?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-07-06 23:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls