What have you tried so far? I'd simply parse out the information with a regular expression (untested):

use strict; for my $item (<DATA>) { chomp $item; if ($item !~ /^\\bibitem\[.*?\] # skip the command and optional +argument \{([A-Z\d]+)\] # extract the bibliography item, + all caps letters \s*(.*?) # extract the author list \((\d{4})\) # extract the year (.*?) # extract the publication title \{\\it\s(.*?)\}, # extract the category \s*\{\\bf\s(\d+)\},# extract the volume \s*(\d+-\d+) # extract the page numbers \. # a dot at the end /x) { print "%% Ignoring weird bibliography item: >$item<\n"; next; }; printf <<'TEX',$1,$2,$3,... @article{%s, ... TEX }; __DATA__ \bibitem[Ao {\it et~al}., 2004]{AGKM04} Ao, W. {\it et~al.} (2001) Som +e long title 1, {\it Science}, {\bf 305}, 1743-1746. \bibitem[Bailey and Elkan, 1995]{BE95} Bailey, T. Elkan, C. (1995) Som +e long title 2 {\it Machine Learning}, {\bf 21}, 51-80.

In reply to Re: Converting Bibitem into Bibtex Entry with Perl by Corion
in thread Converting Bibitem into Bibtex Entry with Perl by monkfan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.