On the off-chance that this is simply a communications problem, and what you really meant was "can you explain what I'd need to do to solve this problem" (though it smells heavily of a take-home interview question...). I am only going to
very basically outline a possible solution.
- Slurp the whole file in at once. (hint: $/).
- Use a pattern match that captures the text between the start and end markers. You'll want the /sm modifiers on the match to make sure you cross line boundaries. (Hint: \t is a tab.)
- Print the captured text.
I'd estimate this to be a very small program. If you're over 20 lines you're overthinking it.
If what I've said here isn't helpful, you really need to settle in with a good Perl tutorial and learn some of this stuff. I recommend Learning Perl as a good start, or here: http://www.perl.com/pub/a/2000/10/begperl1.html.
I am concerned that you're just hoping for a solution. If you read around on Perlmonks you'll find that we seldom just write someone a program. If they post at least a "Here's the code I tried, but this part doesn't work", yes, very often there'll be a "here's a way to solve that" with a partial or even complete solution.
But a plain old "write this for me" smacks of "I can't be bothered to do this myself, I'll take advantage of these people's willingness to write code for free" at best, and seems dishonest at worst - be sure that if you "solve" a problem by getting an answer from Perlmonks, sooner or later it will catch up with you. Managers know how to do web searches too, and the good ones will. (A quick search on strings from your example file input turns up this node, for instance.)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.