To give you an exact answer, I think a little more specifics on what matching criteria you are going to allow is necessary. (e.g. you say that the user can enter 3 as the year. Does that mean that the only number the user can enter for the year, other then the exact year string, is the number that the year ends in? Or, can they enter '2' because that is also a number in the year 2003).
But, at least to get you started...
1. Read in your users' entries via the
param() method.
2. Split your date (which is what I think may be your main concern) like this:
my ($month, $day, $year) = split(/\-|\//, $date); Where
$date is your Excel spreadsheet date.
3. Finally, and this is where I would need some more specifics, do a regex to match the users data to your split
$date. Just an example:
if ($month =~ /$user_month/ || $day =~ /$user_day/ ||
$year =~ /$user_year$/) {
# The regex says: if the excel month contains the
# user's entry for month, or the day contains the
# user's entry for the day, or the year ends in the
# the number that the user entered for year, then
# go ahead and count that as a match. Unless you
# give the exact criteria, I can't come up w/the
# regex. There are a million possibilities. This one
# ,for example, would NOT match if the user didn't
# enter a month or day, but entered the exact year.
# Which is probably not what you want. It would also
# match too many things. (e.g. if the user entered '1'
# for month, it would match 10, 11, 12, 01, etc.).
# Let me know the criteria, and I can come up with the
# correct regex.
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.