Hi,

Now I have modified the script as shown below. I am using for the first time, Please be kind to forgive mistakes.

use Date::Calc qw(Delta_YMD); @date = localtime(); open(LOG, ">veiwreport.txt") or print die $!; @vlist = "raghavr_view11"; foreach(@vlist) { @viewdetails = `cleartool lsview -prop -full $_`; } foreach $vd (@viewdetails) { if ($vd =~ m/Last accessed/) { @details = split(/\s+/,$vd); $accdet = $details[2]; @acc = split(/T/,$accdet); chomp(@acc[0]); print "\nLast accessed : @acc[0]"; print LOG "\t Last accessed : @acc[0]"; $ac=@acc[0]; @ac = split(/\-/,$ac); $year1=@ac[0]; $month1=@ac[1]; $day1=@ac[2]; } if ($vd =~ m/Created/) { @a = split(".",$vd,1); @b = split("T",@a[0]); $b[0] =~ s/(\w)*/ /; $b[0] =~ s/\s+//; print " created on $b[0]"; print LOG " created on $b[0]"; $crd=@b[0]; @cd = split(/\-/,$crd); $year2=@cd[0]; $month2=@cd[1]; $day2=@cd[2]; } $diff = Delta_YMD($year1,$month1,$day1, $year2,$month2,$day2); print "Age of the $vd view is $diff \n"; }

First of all, I am getting the error: Date::Calc::Delta_YMD(): not a valid date at rs.pl line 60. Please suggest, as I am really struck here.


In reply to Re^2: date difference by raghvens
in thread date difference by raghvens

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.