I’m really puzzled with this pattern matching thing…as a beginner in Perl I’m doing a simple HTML form where you have a textbox and some test data in it with text and dates like 03/11/02, 03-11-02 or 03/11/2002. And the thing is I’ve got to get another HTML page with all the data entered in the text field but with the respective dates changed to 3rd November 2002 respectively. I’ve got this code but at the moment it isn’t doing what I want. Regards Ric ##########################################################
#!/cgi-bin/perl -w use CGI; # get the form data $query = new CGI; $textInput=$query->param('textInput'); #start the html page print $query->header; print $query->start_html(-title=>"Ric's"); print "<FONT SIZE='5'>\n"; print "The text entered was:<HR>\n"; print "</FONT>\n"; { print "$textInput<BR>\n"; } ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localt +ime(time); $year =~ s/^\d(\d\d)$/$1/; $mon++; if(length($mon) < 2){$mon = "0" . $mon;} if($year > 90) {$year = "19" . $year;} else{$year = "20" . $year;} if($min < 10){$min= "0$min";} $textInput = "$mday/$mon/$year"; @month = ("-", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); @monthPost = ("-", "st", "nd", "rd", "th", "th", "th", "th", "th", "th +", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th" +, "th", "th", "th", "th", "st"); $textInput = "$mday$monthPost[$mday] $month[$mon] $year"; print "$textInput";

In reply to Date pattern matching by Rpaguilar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.