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!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|