Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: reading flat file

by tospo (Hermit)
on Oct 03, 2011 at 12:35 UTC ( #929316=note: print w/replies, xml ) Need Help??


in reply to reading flat file

Welcome to Perl!
This is easily achievd in Perl and the script to do this won't be very long but there are a few things you need to learn. These are:
  • open a file and read line by line (a solution was shown already in a previous reply)
  • use regular expressions to get the named fields (tag/value pairs) out of the line of text. You could also use "split" to first split on spaces to get a list of tag/value pairs and then split on the "=" for each one to get the tag and the value.
  • read the data into a hash - find out what hashes are and how to populate them and read from them.
Have a go at a short script. Doesn't matter if it doesn't work at first. Post it here if it doesn't work and you will receive more help. Good luck!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929316]
help
Chatterbox?
[LanX]: hmm could be a myth since the root of throne is Greek
[LanX]: erix : the one armed who spent his last years in Dorn castle was a prince of Oranie ;)

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2017-12-15 16:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (439 votes). Check out past polls.

    Notices?