r_mehmed has asked for the wisdom of the Perl Monks concerning the following question:
#!perl use CGI; $query = new CGI; $source = $query->param('input'); print $query->header, $query->start_html('10222161'), $query->h1({-align=>center},'CAD Assignment 1B'), $query->p({-align=>center},'The corrected text is: '), $query->hr; $source =~ m!(\d{1,2})(\/|\-)(\d{1,2})(\/|\-)(\d{2,4})!g; my $day = $1; my $month = $3; my $year = $5; if($day == 1 or $day == 21 or day == 31){ $day .='st'; } elsif ($day == 2 or $day == 22){ $day .='nd'; } elsif ($day == 3 or $day == 23){ $day .= 'rd'; } else { $day .= 'th'; } if($month == 01){ $month = 'January'; } elsif ($month == 2){ $month = 'February'; } elsif ($month == 3){ $month = 'March'; } elsif ($month == 4){ $month = 'April'; } elsif ($month == 5){ $month = 'May'; } elsif ($month == 6){ $month = 'June'; } elsif ($month == 7){ $month = 'July'; } elsif ($month == 8){ $month = 'August'; } elsif ($month == 9){ $month = 'September'; } elsif ($month == 10){ $month = 'October'; } elsif ($month == 11){ $month = 'November'; } else { $month = 'December'; } print $query->p({-align=>center},"$day $month $year"), $query->hr, $query->i({-align=>center},'10222161'), $query->end_html;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pattern matching through a whole document
by BrowserUk (Patriarch) on Nov 01, 2002 at 13:51 UTC | |
by r_mehmed (Sexton) on Nov 01, 2002 at 15:18 UTC | |
|
Re: pattern matching through a whole document
by Thelonius (Priest) on Nov 01, 2002 at 13:49 UTC | |
|
Re: pattern matching through a whole document
by dingus (Friar) on Nov 01, 2002 at 13:52 UTC |