top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How do I find date difference in perl?

+2 votes
403 views
How do I find date difference in perl?
posted Jul 12, 2013 by Jnanesh Kumar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Dont know the exact problem but try and see if it serves the purpose.
($y,$m,$d) = Delta_YMD($year1,$month1,$day1, $year2,$month2,$day2);

answer Jul 12, 2013 by Nora Jones
Similar Questions
+1 vote

I am working on a script to rename files after a formula (discussed here: http://www.drbunsen.org/naming-and-searching-files-part-1/ ) . The formula calls for an ID string that is constructed from the date and time the file is created, of the format YYYMMDD_HHMMSS. The closest approximation of the file creation date that I can find thus far is the inode change time returned by the stat() function. I was under the impression that this would not be too far off from the first save date, but from what I later read and my experimentation, it seems VERY far off the vast majority of the time. The inode change time is more often than not exactly the same as the last modification time, and even when it's not it's nowhere close to the actual date/time of the first time the file was saved.

The ID string here serves two purposes: to make a unique identifier, and to put the files in order by creation date and time. At the very least I figure using the inode change time should produce unique identifiers, but I would like to have chronological order if possible. Unfortunately, I am starting to believe that this is not possible. I have files going back to the mid 1990's, coming from various versions of Windows, as well as files produced over the last few years natively on the Mac. Even the creation dates/times of the native Mac files, as listed in the finder, seem radically incorrect.

Does anyone know if this is possible? Or should I just accept the fact that all dates before 8/2013 are suspect?

+1 vote

How do I find the next subnet? This should print 192.168.1.0 the second time - it errors:

#!/usr/bin/env perl

use strict;
use warnings;

use Net::IP;

my $ip = Net::IP->new('192.168.0.0/24');

print "Start ip [" . $ip->ip . "]n";
print "start mask [" . $ip->prefixlen . "]n";

$ip->set($ip->last_ip);
$ip++;
$ip->set($ip->ip . "/" . $ip->prefixlen);

print "Start ip [" . $ip->ip . "]n";
print "start mask [" . $ip->prefixlen . "]n";

## ERROR
 % ./t2.pl
Start ip [192.168.0.0]
start mask [24]

Can't call method "ip" on an undefined value at ./t2.pl line 15.

+1 vote

There seem to be two modules for it, yet none of them seems to let you do it --- if they do, the documentation doesn't have any example of how to do it.

The alternative seems to be to write MS excel files, and I don't really want to resort to that.

+1 vote

I need to access ClearQuest programatically using Perl. I just found ClearQuest OSLC REST API. Client is planning to use ClearQuest web 7.1.1. I read that it comes with OSLC REST API out the box.
Can someone please provide me some examples on how I can access the CQ through Perl using this API.

...