Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to do pattern matching and output the results?

by kilinrax (Deacon)
on Nov 22, 2000 at 21:03 UTC ( [id://42967]=note: print w/replies, xml ) Need Help??

Something like this, perhaps?
#!/usr/local/bin/perl -w use strict; my $file = 'thesaurus'; open(INFO, $file); print " What are you looking for? "; my $a = <STDIN>; chop $a; my @matches = grep { (index $_, $a) > -1 } <INFO>; print "The following matches were found: @matches\n";

Originally posted as a Categorized Answer.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-19 21:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found