Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to find last sunday (date) using perl? Post 302170790 by deepakwins on Tuesday 26th of February 2008 04:21:11 PM
Old 02-26-2008
Thanks of the input!
May I know what is '@_' does?
Coz, we dont pass any argument to the subroutine. And if I change the statement my($time) = @_; it gives out different result.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Date - Last Sunday thru Saturday

Hi All, I have to kick off a script on every Monday to get some data from database for last week (Sunday thru Saturday). If its Monday (12/12/2005) Begin date will be Sunday - 12/4/2005 End date will be Saturday - 12/10/2005 The script might not kick off on some Mondays. So my... (2 Replies)
Discussion started by: skymirror
2 Replies

2. UNIX for Dummies Questions & Answers

How to find Day of the Week from the given date (Perl)?

How to find the Day of the Week of the given Date using perl? If I have a date in YYY--MM-DD format, how to find the DOW? Based on that, I need to find the following sunday. Pls help. (5 Replies)
Discussion started by: deepakwins
5 Replies

3. Shell Programming and Scripting

Perl: Extracting date from file name and comparing with current date

I need to extract the date part from the file name (20080221 in this ex) and compare it with the current date and delete it, if it is a past date. $file = exp_ABCD4_T-2584780_upto_20080221.dmp.Z really appreciate any help. thanks mkneni (4 Replies)
Discussion started by: MKNENI
4 Replies

4. Shell Programming and Scripting

recurrence for every sunday for Date::MAnip in perl

Hi, I have a requirement to define all Saturdays/Sundays of every month in a year as holidays. I am making use of Date::Manip package available in perl. I tried writing a recurrence as : 0:1*3:7:0:0:0 --> this relation helps me to define 3rd Sunday of a year as sunday. My requirement is... (1 Reply)
Discussion started by: harpreetanand
1 Replies

5. Shell Programming and Scripting

Last sunday of current date

Hi Please help me with this problem i need to find the date of last week sunday from the current given date (12 Replies)
Discussion started by: aishsimplesweet
12 Replies

6. Shell Programming and Scripting

How to derive the last Sunday's date when Current date value is passed

Hi All, I have a requirement in my project where a batch runs on any day of a week. The input files will land to the server every Sunday. I need to read these files based on the current BUS_DAY (which falls any day of the week). For e.g : if the BUS_DAY is 20120308, we need to derive the... (3 Replies)
Discussion started by: dsfreddie
3 Replies

7. Shell Programming and Scripting

How to find last updated date and time of a folder in Perl?

Hi All, I have a process which after some time continues move a files to some folder(say the name of the folder is logdir) What i am trying to do is as the files are coming to the logdir folder, I want the latest updated time and date of the folder in PERL. (1 Reply)
Discussion started by: parthmittal2007
1 Replies

8. Shell Programming and Scripting

Fetch date of 7 years back from current date in Perl

$beginDate = substr(DateCalc("today", "-7Days"),0,8); This fetches the date 7 days back Can I fetch the date before 7 years from todays date in Perl using same syntax Use code tags, see PM. (3 Replies)
Discussion started by: parthmittal2007
3 Replies

9. UNIX for Dummies Questions & Answers

Yesterday's Date if it is Sunday

Hi All, Can you please let me know how to get the yesterday's date of the given date if the given date is Sunday? I can't use GNU. I have the code to get the yesterday's date based on the system date. Thanks (5 Replies)
Discussion started by: shash
5 Replies
Perl::Critic::Policy::Subroutines::RequireFinalReturn(3pUser Contributed Perl DocumentatPerl::Critic::Policy::Subroutines::RequireFinalReturn(3pm)

NAME
Perl::Critic::Policy::Subroutines::RequireFinalReturn - End every path through a subroutine with an explicit "return" statement. AFFILIATION
This Policy is part of the core Perl::Critic distribution. DESCRIPTION
Require all subroutines to terminate explicitly with one of the following: "return", "carp", "croak", "die", "exec", "exit", "goto", or "throw". Subroutines without explicit return statements at their ends can be confusing. It can be challenging to deduce what the return value will be. Furthermore, if the programmer did not mean for there to be a significant return value, and omits a return statement, some of the subroutine's inner data can leak to the outside. Consider this case: package Password; # every time the user guesses the password wrong, its value # is rotated by one character my $password; sub set_password { $password = shift; } sub check_password { my $guess = shift; if ($guess eq $password) { unlock_secrets(); } else { $password = (substr $password, 1).(substr $password, 0, 1); } } 1; In this case, the last statement in check_password() is the assignment. The result of that assignment is the implicit return value, so a wrong guess returns the right password! Adding a "return;" at the end of that subroutine solves the problem. The only exception allowed is an empty subroutine. Be careful when fixing problems identified by this Policy; don't blindly put a "return;" statement at the end of every subroutine. CONFIGURATION
If you've created your own terminal functions that behave like "die" or "exit", then you can configure Perl::Critic to recognize those functions as well. Just put something like this in your .perlcriticrc: [Subroutines::RequireFinalReturn] terminal_funcs = quit abort bailout BUGS
We do not look for returns inside ternary operators. That construction is too complicated to analyze right now. Besides, a better form is the return outside of the ternary like this: "return foo ? 1 : bar ? 2 : 3" AUTHOR
Chris Dolan <cdolan@cpan.org> COPYRIGHT
Copyright (c) 2005-2011 Chris Dolan. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. perl v5.14.2 2012-06-07 Perl::Critic::Policy::Subroutines::RequireFinalReturn(3pm)
All times are GMT -4. The time now is 02:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy