• 0

Looking for some perl help


Question

**Sorry, just saw how you wanted the topic, please adjust....

I am trying to write a search function that splits the results then sends them out to a set of variables to be displayed in another function. The search works but the split doesn't appear to be.

What the overall function needs to do is search for a string through all files in a dir and sub-dir. With the results it will take them and break them down into three parts: dir, file, and the line the string was found on. The result is formatted like this:

/home/name/helps/index/index001:line info

/home/name/helps/win/win001:line info

and I am looking for results like this: ("index" isnt a set length, but it is always char)

(index)(001:)(line info)

(win)(001:)(line info)

My current split looks something like:

my $gregresults { $dir, $num, $info} = split (/*\/(\w*)\s+(\d\d\d:)(.*)/)

When I insert results all I get is $dir and $num but no $info.

I hope I provided enough information. I will be unable to post the exact code b/c I don't have it on me, so I am just running off of what I worked on all night.

Any assistance is appreciated. I have only worked with perl for about 3 days, so if I shouldn't have used {} or something else please don't burn me...to bad. Read a few sections in multiple O' Riley books but I couldn't determine a solution.

Thanks

Edited by moRU
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.