Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Print the data following few specific lines in perl

by ad23 (Acolyte)
on Jul 01, 2010 at 17:47 UTC ( [id://847575]=note: print w/replies, xml ) Need Help??


in reply to Re: Print the data following few specific lines in perl
in thread Print the data following few specific lines in perl

Thank you for your help.

The code which I am trying to run - what is going wrong in there?? I am a beginner, and it would really help if I know how to modify my code to get the desired output??

Cheers!

Replies are listed 'Best First'.
Re^3: Print the data following few specific lines in perl
by BioLion (Curate) on Jul 05, 2010 at 08:02 UTC

    It isn't really a case of right or wrong - you code is doing exactly what you are telling it to - sorting the header lines based on the descriptor field. As you will see all over the place, TIMTOWTDI (there is more than one way to do it) is a core part of Perl programming, so while your method could be made to work, it would be much more complicated than needed (you would need to buffer the squence associated with each header and print them out together, based on testing the header) and ultimately much harder to maintain etc...

    Just try to work out (on paper if needs be) what steps you need to achieve, than code each one of those steps - shortcuts/better/different solutions may occur to you as you work, but the important thing is that the code is clear and well documented.

    Maybe this doesn't answer your question, but really it is all about practice and experience, so the fact that you have made a good attempt shows that in time you'll be laughing at these sort of problems. Keep plugging away and if you get stuck again, come to the Monastery!

    Just a something something...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://847575]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-03-29 10:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found