in reply to regular expressions with commas?
Well, here is what I would start with:
use strict; while(<DATA>) { #using re match. # match beginning, anything except comma, # followed by a comma and 'Y' if(m/^([^,]+),Y/) { print "RE Name:" . $1 . "\n"; } } __DATA__ davis,N brown,Y smith,Y,N,B jones,N,Y,B,A clarke,Y,N,Y
Or Perhaps:
use strict; while(<DATA>) { my @data = split(','); if($data[1] eq 'Y') { print "RE Name:" . $data[0] . "\n"; } } __DATA__ davis,N brown,Y smith,Y,N,B jones,N,Y,B,A clarke,Y,N,Y
Hazah! I'm Employed!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: regular expressions with commas?
by chas (Priest) on Dec 10, 2005 at 14:49 UTC | |
by osunderdog (Deacon) on Dec 10, 2005 at 22:33 UTC | |
|
Re^2: regular expressions with commas?
by webshark (Acolyte) on Dec 10, 2005 at 11:33 UTC |