perl - converting a date into a string

I need a script that displays the date entered by a user as a string. The date can be entered using numbers and forward slashes. I need the date, for example, 6/06/08 displayed as June 6, 2008. Also if the year contains only YY, I need to add 20 to the beginning of the year.
This is what I have so far, but I keep getting errors - also it seems to be reading the array wrong as the month is always one off. ie, reading august when the month entered was july

Use of uninitialized value in pattern match (m//) at c08ex6.cgi line 14.
Use of uninitialized value in pattern match (m//) at c08ex6.cgi line 18.
Use of uninitialized value in concatenation (.) or string at c08ex6.cgi line 19.
Use of uninitialized value in int at c08ex6.cgi line 21.
Use of uninitialized value in concatenation (.) or string at c08ex6.cgi line 21.

use CGI qw(:standard);
use strict;

#declare variables
my ($date, $month, $day, $year);
my @months = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); 

#assign input item to variable
$date = param('Date');

#break date apart
$date =~ /([0-9]{1,2})\/([0-9]{1,2})\/([0-9]{2,2}|20[0-9]{2,2})/;
$month = $1;
$day = $2;
$year = $3;
unless($year =~ /20[0-9]{2,2}/){
    $year = "20".$year;
$date = $months[int($1)]." ".$day.", ".$year;

#display date
print "<HTML><HEAD><TITLE>The Date</TITLE></HEAD>\n";
print "<BODY>\n";
print "The date is: $date\n";
print "</BODY></HTML>\n";

Open in new window

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

was there a value in param('Date') ?
my @months = ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
Do you understand that
$months[0] eq "January"
$months[1] eq "February"
etc. ?
childoftheetherAuthor Commented:
Yes - there is another page that has a input box the date goes in, then when its submitted it sends it to the script which is supposed to display the string...   thats just a simple

<form action="" method="post">
  <p align="center">Date:
  <input type="text" name="Date" size="30" /><br />
  <input type="submit" value="Submit" />
What about splitting the date instead of matching regexp?

#assign input item to variable
my ($month, $day,$year) = split('/', param('Date'));
if ($year < 99 ){$year += 2000;}
$date = $months[$month-1] . " $day, $year";
#display date

Note the -1 in index of months, then 1 will provide index of [0], which is January.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Scripting Languages

From novice to tech pro — start learning today.