Hello again wise monks :)

I have a list of weekdays:

my @weekdays = qw( Today Yesterday Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday );

I need to format these weekdays into an absolute numerical date based off of scalar localtime. eg:

my ($local_weekday, $local_month, $local_numerical_date) = split (/\s+ +/, scalar localtime), 3; __END__ Fri Apr 28 'Yesterday' would be '27'

I need to use $local_weekday and $local_numerical_date (eg. 'fri 28') to format @weekdays from the list. eg. 'wednesday' to eg. '26'.

Also, i never need to check what the numerical date in the future is, it is always current date or earlier. I am pretty sure there is a way to loop while subtracting but I cant figure it out lol.

If I can be any more clear on anything please let me know. I have tried to explain it the best i can :)

EDIT: changed 'wednesday 27' to just '27' and added 'Yesterday' would be '27' to __END__


In reply to Convert weekday to numerical date by james28909

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.