Link to home
Start Free TrialLog in
Avatar of boofulls
boofulls

asked on

put chosen words into file

id like a script that loads up a text file "myfile.txt" and places a checkbox after each word. When a checkbox is selected that number word and word are placed into a file

ie
if "myfile.txt" contains
here is my story. thanks for reading.
when i execute my script i will see
here [] is [] my [] story []. thanks [] for [] reading [].

there will be a submit and reset button at the end and if for example i click the check boxes after "here" "thanks" and "reading" and file called "gaps.txt" will then contain
1 - here
5 - thanks
7 - reading

thank u
ASKER CERTIFIED SOLUTION
Avatar of Mindo
Mindo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of boofulls
boofulls

ASKER

can u tell me what the cnt.txt file is for?
thanks
cnt.txt file is to save the number of words in the myfile.txt.
ok thats great
one kinda related questionso i put the points up

in different code the story file is loaded up again and drop down menus are placed in....but it prints the story without periods "." and "?" "!" etc

i think the problem is here

   while(<F>)
   {
   while(/(\w+)/g)
   {
etc.......

should i change the second while loop so it will load up "!" "." "?" etc.....

thanks
The \w+ means that only the words are taken. What is meant by \w you can take a look at Perl manual. As i remember it's lowercase and uppercase letters, the undescore.

Do the following:

while(<F>)
   {
   while(/([\w!.?]+)/g)
   {
etc.......