in reply to Parsing the year out of date

Or just grab the first four digits.
my ( $y ) = /(\d{4})/;
Boris

Replies are listed 'Best First'.
Re^2: Parsing the year out of date
by TGI (Parson) on Oct 20, 2005 at 20:32 UTC

    borisz meant the first group of four digits, which is perfect if you can count on the data format.

    Why not do your loop all in one line?

    my @years = map /(\d{4})/, @dates;

    Of course, you could use any regex that satisfies in the code above. Note that the parenthesis are critical, without them you'll wind up with a list full of '1'.

    Update Thanks to Roy Johnson I fixed my regex. Left out the \ for the \d.


    TGI says moo