Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
My desired result is:#!/usr/bin/perl use strict; use warnings; while (<DATA>) { my $one = $1 if /^\{\w+\s+\d+\}([^\s\t]+)/; my $two = $1 if /^\{\w+\s+\d+\}\s+(.*)/; print "ONE: $one\n"; print "TWO: $two\n"; } __DATA__ {STRING 4} 123.122.124.125 some text here
Any ideas what I'm doing wrong. This should work!ONE: {STRING 4} TWO: 123.122.124.125 some text here
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Silly RegEx problem
by cLive ;-) (Prior) on Feb 19, 2004 at 18:51 UTC | |
|
Re: Silly RegEx problem
by Wonko the sane (Curate) on Feb 19, 2004 at 18:44 UTC | |
|
Re: Silly RegEx problem
by ysth (Canon) on Feb 19, 2004 at 21:14 UTC | |
|
Re: Silly RegEx problem
by dragonchild (Archbishop) on Feb 19, 2004 at 18:47 UTC |