A lot of guessing, but it sounds like you're looking for something like this:

my ($month, $day, $year) = $line =~ / (Jan|Mar|Dec) # the month abbreviations we want \s+ # followed by one or more spaces (\d+) # then one or more digits \s+ # then one or more spaces (\d+) # then one or more digits /x;
To clarify: I'm not sure if you're always looking for the same month, an abbreviation, a series of months, or a series of month abbreviations. This little example will work for a series of month abbreviations. Substitute whatever you need for the (Jan|Mar|Dec). (Keep the parentheses).

Next, I'm assuming that by "fields" you mean space separators for the month and year, which always appear in that order, as numbers. If you meant something else by "fields", you need to be more specific. This statement will assign those three parts to the three variables $month, $day, and $year. (Assuming your input string is in $line.)

If you haven't seen it before, the /x at the end of the pattern allows embedding comments and whitespace. It increases readability a lot.

As I said, there's a lot of guessing here on my part. If you want to be more general (for example, being able to handle more date formats), take a look at the many date-handling routines on CPAN.

HTH


In reply to Re: Pulling Date out of String by VSarkiss
in thread Pulling Date out of String by GreatWhite

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.