Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: regex issue

by d5e5 (Beadle)
on Nov 10, 2010 at 21:07 UTC ( #870697=note: print w/replies, xml ) Need Help??


in reply to regex issue

^ in a regex pattern means 'starts with'. No line starts with Lesle.

/43500$/ is incomplete. You have to say match it with $inp.

Try this:

#!/usr/bin/perl use strict; use warnings; while(my $inp = <DATA>){ if ($inp =~ /Lesle/ .. $inp =~ /43500$/){ print "$inp\n"; } } __DATA__ 41 Tommy Savage:4087240140: 12 2 2 Oxbow Court, Sunnyvale, CA 94087 +: 5/19/66: 34200 42 Lesle Kerstin: 408456123 4: 4 Harvard Square, Boston, MA 02133: +4/22/62: 52600 43 JonDeLoach: 4082533 122: 12 3 Park St. , San Jose, CA 94086: 7/2 +5/53: 85100 44 Ephram Hardy:2932595395: 2 3 5 Carlton Lane, Joliet, IL 73858: 8 +/12/20: 56700 45 etty Boop: 24583683 57: 63 5 Cutesy Lane, Hollywood, CA 91464: 6 +/23/23: 14500 46 Wilhelm Kopf:8468362837 : 693 7 Ware Road, Milton, PA 93756: 9/2 +1/46: 43500 47 Norma Corder:397857 2735: 74 Pine Street, Dearborn, MI 23874: 3/ +28/45: 245700 48 James Ikeda: 8349388376: 2 3 445 Aster Ave. , Allentown, NJ 8374 +5: 12/1/38: 45000 49 Lori Gortz: 3278325728: 3 465 Mirlo Street, Peabody, MA 34756: 1 +0/2/65: 35200 50 Barbara Kerz:385573 8326: 83 2 Ponce Drive, Gary, IN 83756: 12/1 +5/46: 268500

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2023-03-30 02:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (73 votes). Check out past polls.

    Notices?