On Sun, Dec 12, 2010 at 8:11 PM, shawn wilson <ag4ve...@gmail.com> wrote: > i'm trying to exclude undefined variables for that are to be put into > a sql database date field, but none of this is working:
errr, sorry, my error with the current code is: Global symbol "$corrected" requires explicit package name at ./uscg-get.pl line 139. line 139 is 'return $corrected;' > > sub correctdate { # make valid sql DATE field > my $date = $_[ 0 ]; > > my ($month, $day, $year) = split / /, $date if defined( $date ); > > $day =~ s/,//g if defined( $day ); > > my %monnum = qw( > January 01 February 02 March 03 April 04 May 05 > June 06 July 07 August 08 September 09 October 10 > November 11 December 12 > ); > > if( $year && $month && $day ) { > my $corrected = "$year-$monnum{$month}-$day"; > } else { > my $corrected = "0000-00-00"; > } > > return $corrected; > } > > my dates are listed such as 'December 1, 2009' > and, just to confirm what i was saying in my prior email, when i > really care about the timestamp, i do: > $pageth->execute( $vid, time(), $content ); > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/