my $dateis = "2Jul2001";
my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;

print "$date - $month - $year \n";

:)

with regards,

Pierre

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 03, 2001 12:24 PM
Subject: A Split Question


>
> Hi.
>
> My file has dates in it that either come out as "2Jul2001" or "21Jul2001".
So one or two digits for the day, three for the month, and four for the
year.
>
> So I would like to split out the day, month, year, and am interested in
splitting techniques, where there are no delimeters.
>
> Of course, I could just test the length and then use substr it all out, or
even sprintf it into a new variable with a pad at the first character.
>
> But this is perl, and I reckon there are much cooler ways to do it.
>
> Any takers?
>
> Paul.
>
>
>
> ------------------------------------------------
> Global WebMail -
>   Delivered by Global Internet www.global.net.uk
> ------------------------------------------------
>
>

Reply via email to