I strongly recommend that you follow the links (did I make them too subtle?) and read the documentation. In fact spending a few hours browsing the documentation that came with Perl and a few more hours reading some of the Perl tutorial and reference books ("Learning Perl" and "Programming Perl" at least) will save you days of beating your head against the desk if you intend to use Perl regularly. There are some good recommendations in the So what is your Perl book "Trilogy" anyway? thread. Visiting the Tutorials section is well worth doing too.

I followed the pattern you gave (">$filename"."$title"."$count") for forming the file name. The sequence number following the file name is what you would have got in your original code. If you want to put it before the last '.' then you need to edit the file name string. Something like the following in place of the original $outpath assignment ought do the trick:

my $outpath = "$outdir/$title"; $outpath =~ s/(\.[^.]*|)$/$.$1/;

You will definitely want to read some of the documentation for regular expressions: perlrequick and perlretut at least (there is more).

True laziness is hard work

In reply to Re^3: extract and export to multiple files by GrandFather
in thread extract and export to multiple files by zzgulu

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.