![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help with perl and if file statement | Dadwith2boys | Shell Programming and Scripting | 1 | 09-01-2009 06:33 PM |
| case statement in UNIX scripting (ksh) | luna_soleil | UNIX for Dummies Questions & Answers | 4 | 03-03-2009 02:05 AM |
| Problem with if statement in perl | kamitsin | Shell Programming and Scripting | 2 | 10-04-2008 01:19 PM |
| Perl equivalent of ksh if / echo statement | gefa | Shell Programming and Scripting | 2 | 02-17-2005 12:07 PM |
| perl if statement | Bashar | Shell Programming and Scripting | 3 | 12-25-2004 06:12 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
help with if statement perl scripting
Sorry for the newbie question
I need to create a perl script to check the modifed time of a file I already have that part created but need help in creating a if statement that basicly will check to see if the modifed time is at least 2hrs older then the current time if the stament is true to send out a email here is what I have the print statement are mainly just for debugging purpose Code:
#!/usr/bin/perl
use strict;
use warnings;
use POSIX;
# To get time
my $currDate = time;
my $thisFile = "/usr/local/ahps2/tmp/****";
my $mtime = (stat($thisFile))[9];
print "1: $mtime \n";
my @lt = localtime($mtime);
# The get file info
my $ptime = strftime ("%R",@lt);
print "2: $ptime \n";
print "3: $currDate \n";
print "\n";
print $currDate . "\n";
Last edited by pludi; 2 Weeks Ago at 02:31 AM.. Reason: code tags, please... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|