%months = ( Jan => 1, Feb => 2, Mar => 3, Apr => 4, May => 5, Jun => 6, Jul => 7, Aug => 8, Sep => 9, Oct => 10, Nov => 11, Dec => 12, ); while (<>) { printf "oai:utas.edu.au:%s\t%d-%02d-%02d\n", $1, $4, $months{$3}, $2 if m{<th valign="top" class="ep_row">ID Code:</th><td valign="top" class="ep_row">([0-9]+)</td></tr><tr><th valign="top" class="ep_row">Deposited By:</th><td valign="top" class="ep_row"><span class="ep_name_citation"><span class="person_name">[^<]+</span></span></td></tr><tr><th valign="top" class="ep_row">Deposited On:</th><td valign="top" class="ep_row">([0-9]{2}) (\w+) ([0-9]{4})( [^<]+)?</td>}; }