<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Perl script not working as expected in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245419#M677066</link>
    <description>Hi Experts,&lt;BR /&gt;&lt;BR /&gt;I want to check if a file how old is the file. to check this the simple code is as below.&lt;BR /&gt;&lt;BR /&gt;##############################################&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;$file="/tmp/access_test_log";&lt;BR /&gt;my($SECS) = 24*60*60; #seconds in a day&lt;BR /&gt;&lt;BR /&gt;my $ageinsecs = int((-M $file)* $SECS);&lt;BR /&gt;print "value of age in secs is $ageinsecs";&lt;BR /&gt;##############################################&lt;BR /&gt;output is as below:&lt;BR /&gt;value of age in secs is 0&lt;BR /&gt;&lt;BR /&gt;Where ls -l /tmp/access_test_log&lt;BR /&gt;-rw-r-----    1 root     system            0 Jun 21 15:39 /tmp/access_test_log&lt;BR /&gt;&lt;BR /&gt;so if we see actually it is very old file but output say 0. Can some one help me to fix the issue???&lt;BR /&gt;&lt;BR /&gt;KAKA</description>
    <pubDate>Mon, 28 Jun 2010 07:39:45 GMT</pubDate>
    <dc:creator>KAKA_2</dc:creator>
    <dc:date>2010-06-28T07:39:45Z</dc:date>
    <item>
      <title>Perl script not working as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245419#M677066</link>
      <description>Hi Experts,&lt;BR /&gt;&lt;BR /&gt;I want to check if a file how old is the file. to check this the simple code is as below.&lt;BR /&gt;&lt;BR /&gt;##############################################&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;$file="/tmp/access_test_log";&lt;BR /&gt;my($SECS) = 24*60*60; #seconds in a day&lt;BR /&gt;&lt;BR /&gt;my $ageinsecs = int((-M $file)* $SECS);&lt;BR /&gt;print "value of age in secs is $ageinsecs";&lt;BR /&gt;##############################################&lt;BR /&gt;output is as below:&lt;BR /&gt;value of age in secs is 0&lt;BR /&gt;&lt;BR /&gt;Where ls -l /tmp/access_test_log&lt;BR /&gt;-rw-r-----    1 root     system            0 Jun 21 15:39 /tmp/access_test_log&lt;BR /&gt;&lt;BR /&gt;so if we see actually it is very old file but output say 0. Can some one help me to fix the issue???&lt;BR /&gt;&lt;BR /&gt;KAKA</description>
      <pubDate>Mon, 28 Jun 2010 07:39:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245419#M677066</guid>
      <dc:creator>KAKA_2</dc:creator>
      <dc:date>2010-06-28T07:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script not working as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245420#M677067</link>
      <description>Hi KAKA,&lt;BR /&gt;&lt;BR /&gt;I also get "0" for a non-existing file. You probably have an invisible character somewhere in the file name path.&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;John K.</description>
      <pubDate>Mon, 28 Jun 2010 08:22:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245420#M677067</guid>
      <dc:creator>john korterman</dc:creator>
      <dc:date>2010-06-28T08:22:22Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script not working as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245421#M677068</link>
      <description>I dont see any such invisible character in the file path name.&lt;BR /&gt;&lt;BR /&gt;Is there other way around to check how old is file???&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;KAKA</description>
      <pubDate>Mon, 28 Jun 2010 08:33:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245421#M677068</guid>
      <dc:creator>KAKA_2</dc:creator>
      <dc:date>2010-06-28T08:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script not working as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245422#M677069</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Generalize your script and be defensive:&lt;BR /&gt;&lt;BR /&gt;# cat ./myage&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my $file      = shift or die "filename expected\n";&lt;BR /&gt;die "'$file' doesn't exist\n" unless -f $file or -d $file;&lt;BR /&gt;my $SECS      = 24 * 60 * 60;  #seconds in a day&lt;BR /&gt;my $ageinsecs = int( ( -M $file ) * $SECS );&lt;BR /&gt;print "value of age in secs is $ageinsecs\n";&lt;BR /&gt;&lt;BR /&gt;# ./myage "file with spaces in name"&lt;BR /&gt;&lt;BR /&gt;# ./myage myfile&lt;BR /&gt;&lt;BR /&gt;# ./myage /tmp&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 28 Jun 2010 11:59:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245422#M677069</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2010-06-28T11:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl script not working as expected</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245423#M677070</link>
      <description>you are great. It solved my issue. Thank You.&lt;BR /&gt;KAKA</description>
      <pubDate>Tue, 29 Jun 2010 07:04:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-script-not-working-as-expected/m-p/5245423#M677070</guid>
      <dc:creator>KAKA_2</dc:creator>
      <dc:date>2010-06-29T07:04:08Z</dc:date>
    </item>
  </channel>
</rss>

