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

Use backreferences, like this:

while (<DATA>) { print "match on $1\n" if /^\S+ (\d+) \S+ \1$/; } __DATA__ foo 1000 bar 1000 foo 1000 bar 500

--
David Serrano

Replies are listed 'Best First'.
Re^2: regex search valid only if registers n and n+1 are equal?
by Voronich (Hermit) on Jun 30, 2006 at 20:17 UTC
    yeesh. "backreference" is the word that unlocked the universe here. Thanks :)
    http://www.mpwilson.com/uccu/