CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
regexp question:

 



zohar81
New User

Mar 6, 2008, 7:11 AM

Post #1 of 2 (528 views)
regexp question: Can't Post

Hello,

i'd like to detect all the lines that their first alpha-numeric word repeats more then once.

for example: this line would be 'hits'
abc sda asd asd abc
aaa bbb ccc aaa aaa

unfortunately i only find how to do it in more than one code line.
meaning that at first i extract the first word, and then i make the replacements.

$string =~ m/(\w+)/;
$string =~ s/$1/$replace_string/;

i don't know how to count the number of occurrence of the first line. so i'll hit only the lines that their first word repeats itself at some point.

i also believe that there is more elegant way to do it.

thanks,


KevinR
Veteran


Mar 6, 2008, 8:41 AM

Post #2 of 2 (527 views)
Re: [zohar81] regexp question: [In reply to] Can't Post

I don't understand what you are doing or what your question is. Use some real data and show what you want to accomplish.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives