i'm having trouble matching in perl. i'd like to read from an existing file and match certain data types, then pass what has matched into an array...can anyone help?
Ummm...I'm not a professional programmer or anything but I do believe that plain vanilla Perl or any other language doesn't care too much about the data types that have been laid out in a datafile which (I assume) is binary. This is all just a concept based on the type of format that the writing program has used to write out the stream which (hopefully) you have some clue to...
Sorry, but I think you need to include more information or an example or something.
i think what you mean is, you want to search the contents of a file(s) and check to see if you find a match, right?
if so try this:
open (SEARCH, "path/to/myfil.dat"
for($i = 0; <SEARCH>; $i++)
{
$file_contents[$i] = $_;
if ($search eq $file_contents[$i])
{
Do you stuff here
END;
}
}
close (SEARCH);
that should open the file, and put it into an array for you (handy for later) and then match up your search string to each of those array elements until/unless it finds one that matches where it should end. What ever you want to do with the data you've matched up, do inside the if loop (print it out/whatever) if your doing the program i think, (webmnkeys tutorial - the move library/review?) then this should be a sinch
Good Luck
Sib
thanks al!
yes, after i submitted it i realized that i was much to vague..especially after reading some of the other posts. anyways, here is the main task that i am trying to accomplish...
i will have an html document with patterns such as this
6.3.2.1 T_THI
7.3.2.3 G_G
5.2.3.3 S_SH
but many of them...and they refer to a definition later in the doc and i'd like to link them together..so i need a program to reference the letter combination with the corresponding number..then set a source at the location above and a target at the definition later in the document.....
THANKS!
hi
just to be clear..i'll use an example. it would be like making a source link on the T_THI to 6.3.2.1, in many cases more than one, whereever T_THI occurs...and then making the 6.3.2.1 a target in the definitions section....i may split up the docs to do this if it would be easier to do in two programs..anyone have any ideas?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.