-7

I have a file named event.txt and I need a Perl script to open it and read the lines between tag1 and tag2 keywords and print them on the screen.

I have searched the forum and there are similar questions but I don't know how should I open the text file and do such a search.

Borodin
  • 126,100
  • 9
  • 70
  • 144
KM Hs
  • 43
  • 1
  • 1
  • 5
  • Plz, give an example of file and desired result, that you want to get. – user4035 May 16 '13 at 10:45
  • 1
    Stack Overflow isn't a place to get software written for free. If you don't know how to open a file then you don't know Perl at all, and you should either spend some time learning the language or pay someone to write a program for you. It is very discourteous of you to ask for work to be done for nothing when you don't stand a chance of doing it yourself. – Borodin May 16 '13 at 11:56

1 Answers1

2
while (<>) {
  print if /tag1/../tag2/;
}
Borodin
  • 126,100
  • 9
  • 70
  • 144
  • your solution is now working,since it is not including OPEN file giving downvotes is the problem here ,as I linked someone else has hasked similar question and have got 7 upvotes,how comes?! – KM Hs May 16 '13 at 13:12
  • @KMHs: Perl uses the `<>` operator to read from the files named in the command line. You don't have to open the file explicitly. – Borodin May 16 '13 at 13:14