Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Regular expression questions

by prasadbabu (Prior)
on Oct 07, 2006 at 14:30 UTC ( [id://576846]=note: print w/replies, xml ) Need Help??


in reply to Regular expression questions

If I understood your question, this ll finish your job. But I think this is not efficient way, this can be still done with simple logic.

use strict; use warnings; while (<DATA>) { chomp; my $dic = $_; my (@arr) = $dic =~ /([abort])/g; #get the matching letters + my %unique; my $str = join "", grep (!$unique{$_}++, @arr); #make the gr +epped letters unique print $dic, "\n" if ($str eq 'abort'); #print if the order is + a, b, o, r, t }; prints: ------- abort abortion __DATA__ abroad abort abortion boat boaring boart

As imp said, when i tested your code it works fine for me as well.

Prasad

Replies are listed 'Best First'.
Re^2: Regular expression questions
by chinamox (Scribe) on Oct 07, 2006 at 14:43 UTC
    Thanks, this makes great sense. I will try it ASAP.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found