There's more than one way to do things | |
PerlMonks |
Request for comments/ clues on simple text manipulation scriptby NovMonk (Chaplain) |
on Jun 22, 2004 at 20:49 UTC ( [id://368850]=perlquestion: print w/replies, xml ) | Need Help?? |
NovMonk has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, Kind Monks, First, I have a confession-- about a month ago I received some great clues from graff, Belgarion, cLive;-), revdiablo, and punkish concerning this node. I usually thank people who help me out, but this time, illness, life and other misfortunes delayed me. So, I say now, thanks very much, you fellows are a credit to the community, and I'm really sorry for not saying it sooner. Now for my question. I've written a script that works interactively with vi to add some code to a text file. The text file starts out something like this:
When I get done, I get this:
What I need help with is this-- I'd like each tstat line to only show the letters I'm using in the n01 lines below it, for the stuff between one l ban line and the next. I'd also like it to error out if the number of n01 lines in any section (defined as one line beginning with l and the next such line-- there can be any number of such sections in the file, though probably, not more than 3 or 4) exceeds the number of available letters in my array @letters. And I'd like it to do this without munching my text file. Here's my code:
It's very simple stuff, but I am still fairly new and clueless. I assume I need to completely revamp my thinking, if my two enhancements are possible at all. I would appreciate not only ideas but explanations of what I could be doing better. And this time, I'll be more prompt in thanking you for the wisdom. Pax, NovMonk
Back to
Seekers of Perl Wisdom
|
|