artist has asked for the wisdom of the Perl Monks concerning the following question:
Now When I run this:#!/usr/local/bin/perl -w use strict; my $p1 = qr(^.*?\s\-); my $p2 = qr(^.*?Special); my $p3 = qr(^.*?:); my $p4 = qr(^\'.*?\'); foreach (<DATA>){ chomp; m[($p1)|($p2)|($p3)|($p4)]; #print "$_\n"; print "\t","$+\n"; } __DATA__ 'Inside: Single-Quotes' -XYZ the colon after inside 'Also in quotes' and Special Word and -Oops nothing more These are just plain words and dash -X and some data
'Inside: Single-Quotes' -
'Also in quotes' and Special Word and -
These are just plain Special words and dash -
I would like to have
Inside Also in quotes These are just plainThanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Another First Pattern Matching
by merlyn (Sage) on Jul 15, 2002 at 19:18 UTC | |
|
Re: Another First Pattern Matching
by BUU (Prior) on Jul 15, 2002 at 19:37 UTC |