Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Parsing simple text, made difficult

by varian (Chaplain)
on May 27, 2007 at 16:05 UTC ( [id://617748]=note: print w/replies, xml ) Need Help??


in reply to Parsing simple text, made difficult

To allow others to help you better please use code tags around your program code, the data and the output, to make your post more readable. Also it seems that the code that you posted lost a couple of square brackets
e.g.: $finish$x should probably read as:  $finish[$x]

Even more important: add "use strict;use warnings;" in your code so that Perl itself can help you! If you switch on warnings you will find a wealth of useful information to help you structure your program.

Your program as is:

  • parses only the initial 25 lines (= 200 fields), remaining lines are ignored. Is that by intention?
  • adds a tab as the last character before the newline
    you probably want to remove \t at the line with: elsif( $f eq 8) { print OUT "\n"; $f=0;}
What 'other information' did you get that you did not want?

Update:After posting I noticed that Liverpole has provided an excellent answer already

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-19 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found