RE: Last Wednesday of Month
I took at the doc and it states that it comes back empty if not valid. So you could do something like: @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,5); # start w/ 5th wed of month if (scalar(@last_wednesday)) { # if a value, then 5th wed exists }else { @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,4); # try 4th Wed } print @last_wednesday, "\n\n"; Wags ;) -Original Message- From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 09:06 To: [EMAIL PROTECTED] Subject: Last Wednesday of Month Howdy: Can someone clue me in as to how I can get the last Wednesday (or whatever) of the month? I have an example of what *might* work, but I'm not sure how I can use it if, say, there are five Wednesdays in the Month. [snip from code] #!/usr/bin/perl -w use strict; use warnings; use Date::Calc qw(:all); my $month=(localtime())[4]+1; my $year=(localtime())[5]; my $new_year=$year + 1900; my @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,4); print @last_wednesday, "\n\n"; [/snip code] In the definition of @last_wednesday, if I change ($new_year, $month, 3, 4) to ($new_year, $month, 3, 5), it could return nothing. I'm not sure how to test that. Suggestions? Thanks! -X ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Last Wednesday of Month
--Looks great! --Thanks! -X -Original Message- From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 12:40 PM To: Johnson, Shaunn; [EMAIL PROTECTED] Subject: RE: Last Wednesday of Month I took at the doc and it states that it comes back empty if not valid. So you could do something like: @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,5); # start w/ 5th wed of month if (scalar(@last_wednesday)) { # if a value, then 5th wed exists }else { @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,4); # try 4th Wed } print @last_wednesday, "\n\n"; Wags ;) -Original Message- From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]] Sent: Friday, November 22, 2002 09:06 To: [EMAIL PROTECTED] Subject: Last Wednesday of Month Howdy: Can someone clue me in as to how I can get the last Wednesday (or whatever) of the month? I have an example of what *might* work, but I'm not sure how I can use it if, say, there are five Wednesdays in the Month. [snip from code] #!/usr/bin/perl -w use strict; use warnings; use Date::Calc qw(:all); my $month=(localtime())[4]+1; my $year=(localtime())[5]; my $new_year=$year + 1900; my @last_wednesday = Nth_Weekday_of_Month_Year($new_year,$month,3,4); print @last_wednesday, "\n\n"; [/snip code] In the definition of @last_wednesday, if I change ($new_year, $month, 3, 4) to ($new_year, $month, 3, 5), it could return nothing. I'm not sure how to test that. Suggestions? Thanks! -X ** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited.
RE: Last Wednesday of Month
Hi, In one of my scripts I am trying to grep lines from a list that doesn't have the word HOLD @temp_str = grep ( {$_ ne /HOLD/}, @temp_str); Can anybody help me on this. Satya Devarakonda IS - EDI Tufts Health Plan Tel: 617-923-5587 X 3413 Fax: 617-923- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Last Wednesday of Month
> "Shaunn" == Shaunn Johnson <[EMAIL PROTECTED]> writes: Shaunn> Can someone clue me in as to how I Shaunn> can get the last Wednesday (or whatever) Shaunn> of the month? use Date::Manip; print UnixDate(ParseDateString("last wed of oct 2002"), "%m/%d/%Y\n"); => "10/30/2002\n" -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]