in reply to inserting date into mysql

In addition to what Corion has already posted, the first print statement
    print "$tdate\n";
seems to produce the output
    "10/14/2011"
in which " (double-quote) characters are present at the beginning and end of the string that is printed. Is this something the  UnixDate() function is going to be happy with?

BTW: What does baperl think would be the result of executing the
    my $trade_dt = DATE(\"$tdate\");
statement? I have my answer...

Replies are listed 'Best First'.
Re^2: inserting date into mysql
by NetWallah (Canon) on Oct 17, 2011 at 06:02 UTC
    Spot-on! (AnomalousMonk ++)

    This modification fixes the problem:

    my $trade_dt=UnixDate($x=~/([\/\d]+)/,qq|%Y-%m-%d|);
    (Assuming you are using UnixDate from Date::Manip)
    UnixDate silently returns undef when provided a quoted value.

                "XML is like violence: if it doesn't solve your problem, use more."