<?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 Re: Perl Code help to clean 7 days old log files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732632#M786368</link>
    <description>&lt;BR /&gt; Hi Hein,&lt;BR /&gt;&lt;BR /&gt; I totaly agree with you as there is no harm using -M operator, I have worked hard to do some research and understood how to use -M operator and globbing, but unfortunately my senior colleague is being smart and idiot and he wants me to write this script using OPENDIR function and use local:time function...&lt;BR /&gt;&lt;BR /&gt;With your help I have sorted out everything but I think my senior has got problems, he thinks -M operator and using 'glob' function is just not right, "what a joker"  no one at work likes him to be honest:)&lt;BR /&gt;&lt;BR /&gt;Could you please do me a favour and correct the code when you get a chance so I can get this resolved..&lt;BR /&gt;&lt;BR /&gt;Thanks for your support and help...&lt;BR /&gt;&lt;BR /&gt; Many Regards,&lt;BR /&gt; Raf</description>
    <pubDate>Fri, 17 Feb 2006 00:31:48 GMT</pubDate>
    <dc:creator>Becke</dc:creator>
    <dc:date>2006-02-17T00:31:48Z</dc:date>
    <item>
      <title>Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732608#M786344</link>
      <description>Hi Guys,&lt;BR /&gt;&lt;BR /&gt; I'm fairly new to perl, I'm writing a simple perl script to clean up the log files older than 7 days, my script below works fine upto where its copying the files to log directory.&lt;BR /&gt;&lt;BR /&gt; However when I'm unable to figure out on how to delete the files older than 7 days in my code below.&lt;BR /&gt;&lt;BR /&gt; Please let me know how to delete files older than 7 days in the code below, what else I need to do in the code?? and also if I'm wrong in the code anywhere?...here is the code&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;foreach (glob("*")) { &lt;BR /&gt;   print; &lt;BR /&gt;   my $age = -M ; &lt;BR /&gt;   my $logfile = "/var/spool/cleanlogs.out";  &lt;BR /&gt;   if ($age &amp;gt; 7) { &lt;BR /&gt;   OPEN (STDOUT, "&amp;gt;&amp;gt;$logfile");&lt;BR /&gt;      print " IS OVER 7 days old\n"; &lt;BR /&gt;   } else { &lt;BR /&gt;      print " is ",int($age)," days old\n";&lt;BR /&gt;   CLOSE (STDOUT); &lt;BR /&gt;   } &lt;BR /&gt;} &lt;BR /&gt;##############################################&lt;BR /&gt;&lt;BR /&gt;Output starts ... &lt;BR /&gt; &lt;BR /&gt;4gen is 0 days old &lt;BR /&gt;am is 3 days old &lt;BR /&gt;badday.jpg is 5 days old &lt;BR /&gt;courseend.linux IS OVER 7 days old &lt;BR /&gt;courseend.ms IS OVER 7 days old &lt;BR /&gt;cw IS OVER 7 days old &lt;BR /&gt;d06 is 1 days old &lt;BR /&gt;dl IS OVER 7 days old &lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raf</description>
      <pubDate>Wed, 15 Feb 2006 20:42:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732608#M786344</guid>
      <dc:creator>Becke</dc:creator>
      <dc:date>2006-02-15T20:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732609#M786345</link>
      <description>Hi Raf:&lt;BR /&gt;&lt;BR /&gt;$_ contains the name of the current list element from the 'foreach' loop, as you are aware.&lt;BR /&gt;&lt;BR /&gt;Thus:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;print "$_ is over 7-days old...deleting\n";&lt;BR /&gt;unlink $_;&lt;BR /&gt;&lt;BR /&gt;unlink() will work on a list or $_ if omitted.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Wed, 15 Feb 2006 20:49:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732609#M786345</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-02-15T20:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732610#M786346</link>
      <description>&lt;BR /&gt;As JRF indicates, you can use unlink to delete.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;  I'm fairly new to perl,....&lt;BR /&gt;&lt;BR /&gt;Free advice...&lt;BR /&gt;&lt;BR /&gt;1) The script is a litlle scary, in that it will merrily delete anything from anywhere if 'accidently' run. Maybe change the wildcard to "*.log" as appropriate, or include a partial directory ( "log/*" ). Somethign, anything to stop it from unqualified deletes.&lt;BR /&gt;Or... replace the unlink by a 'rename $_, $to_be_deleted'. Using this $to_be_deleted directory as staging for a final delete.&lt;BR /&gt;&lt;BR /&gt;2) Don't use the same literal twice. Ever. Declare a variable/constant and use that.&lt;BR /&gt;my $MAX_AGE = 7;&lt;BR /&gt;:&lt;BR /&gt;if ($age &amp;gt; $MAX_AGE)  {&lt;BR /&gt;:&lt;BR /&gt;print "IS OVER $MAX_AGE days old\n";&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3) Don't overload STDOUT/STDERR/STDIN&lt;BR /&gt;Whoever reads you script later will be mighty confused to find STDOUT is NOT really that.&lt;BR /&gt;Use something simple, yet more descriptive, for example LOG or OUT or CLEAN.&lt;BR /&gt;&lt;BR /&gt;Cheers!&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2006 21:24:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732610#M786346</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-02-15T21:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732611#M786347</link>
      <description>&lt;BR /&gt; Thank you very much James  and Hein my scripts works like a charm,&lt;BR /&gt;&lt;BR /&gt; James I have followd your instructions and included $_, but I agree with Hein that it is a bit scary to run,&lt;BR /&gt;&lt;BR /&gt; I have couple of more questions&lt;BR /&gt;&lt;BR /&gt; 1. What do I do in my code so, it recreates the log file every time I run the script??&lt;BR /&gt;&lt;BR /&gt; 2. Hein to stop it from unqualified deletes, can you please correct my code below, as i only want to delete log files in '/var/spool/uv/test' directory, and also i don't want to append the log file, i just wanna recreate it everytime the script runs...&lt;BR /&gt;&lt;BR /&gt; Please correct my code below...&lt;BR /&gt;&lt;BR /&gt; #!/usr/local/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;foreach (glob ("*u*")) {&lt;BR /&gt;print;&lt;BR /&gt;my $logfile = "/var/spool/uv/test/cleanfiles.out";&lt;BR /&gt;my $result = -M;&lt;BR /&gt;if ($result &amp;gt; 7) {&lt;BR /&gt;open (STDOUT, "&amp;gt;&amp;gt;$logfile");&lt;BR /&gt;print "$_ is over 7 days old..removing\n";&lt;BR /&gt;unlink $_;&lt;BR /&gt;} else {&lt;BR /&gt;print " is ",int($result), " days old\n";&lt;BR /&gt;close (STDOUT);&lt;BR /&gt; }&lt;BR /&gt;}</description>
      <pubDate>Wed, 15 Feb 2006 22:57:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732611#M786347</guid>
      <dc:creator>Becke</dc:creator>
      <dc:date>2006-02-15T22:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732612#M786348</link>
      <description>Hi Raf, &lt;BR /&gt;&lt;BR /&gt;When do you want to create log file, during the time of execution or after that ? &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Wed, 15 Feb 2006 23:18:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732612#M786348</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-15T23:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732613#M786349</link>
      <description>To change append to re-create, just replace &amp;gt;&amp;gt; with &amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; only want to delete log files in '/var/spool/uv/test' directory,&lt;BR /&gt;&lt;BR /&gt;Maybe simple hard-code that part.&lt;BR /&gt;Better still, combine it with the cleanuplog.&lt;BR /&gt;&lt;BR /&gt;I guess there is no conflict with the log file, as that will be recent.&lt;BR /&gt;&lt;BR /&gt; &amp;gt;&amp;gt; Please correct my code below...&lt;BR /&gt;&lt;BR /&gt;Here is a quick, untested, attempt:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/usr/local/bin/perl&lt;BR /&gt;use strict;&lt;BR /&gt;my MAX_AGE = 7;&lt;BR /&gt;my TEST_DIR = "/var/spool/uv/test/";&lt;BR /&gt;my $logfile = $TEST_DIR . "cleanfiles.out";&lt;BR /&gt;&lt;BR /&gt;open (LOG, "&amp;gt;$logfile") or die "failed to create new $logfile";&lt;BR /&gt;&lt;BR /&gt;foreach (glob ("${TEST_DIR}*")) {&lt;BR /&gt;my $result = -M;&lt;BR /&gt;if ($result &amp;gt; $MAX_AGE) {&lt;BR /&gt;print LOG "$_ is over $MAX_AGE days old..removing\n";&lt;BR /&gt;unlink $_;&lt;BR /&gt;} else {&lt;BR /&gt;$result = int($result);&lt;BR /&gt;print LOG "$_ is $result days old\n";&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;close LOG;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2006 23:21:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732613#M786349</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-02-15T23:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732614#M786350</link>
      <description>&lt;BR /&gt;Here is an other thought, in case you are really worried about accidental deletes.&lt;BR /&gt;&lt;BR /&gt;Make that log file dual - function.&lt;BR /&gt;&lt;BR /&gt;Make the recent file comment lines,&lt;BR /&gt;and turn the "over 7" lines into remove commands.&lt;BR /&gt;Now after running the first script, review the log, and then actually execute the log.&lt;BR /&gt;&lt;BR /&gt;Again untested...&lt;BR /&gt;&lt;BR /&gt;:&lt;BR /&gt;open (LOG, "&amp;gt;$logfile") or die "failed to create new $logfile";&lt;BR /&gt;print LOG "#!/usr/bin/sh";&lt;BR /&gt;&lt;BR /&gt;foreach (glob ("${TEST_DIR}*")) {&lt;BR /&gt;my $result = -M;&lt;BR /&gt;if ($result &amp;gt; $MAX_AGE) {&lt;BR /&gt;print LOG "rm $_ \n";&lt;BR /&gt;} else {&lt;BR /&gt;$result = int($result);&lt;BR /&gt;print LOG "# $_ is $result days old\n";&lt;BR /&gt;}&lt;BR /&gt;:&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Feb 2006 23:31:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732614#M786350</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-02-15T23:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732615#M786351</link>
      <description>&lt;BR /&gt; Hi Hein,&lt;BR /&gt;&lt;BR /&gt; Thanks for your help mate, it really helped me get my script working..&lt;BR /&gt;&lt;BR /&gt; sorry if i confused you, all I need to know, how do only delete something in '/var/spool/uv/test' directory with files starting with 'u'....&lt;BR /&gt;&lt;BR /&gt;your latest post didn't help me but the very first one did...&lt;BR /&gt;&lt;BR /&gt;Please let me know...&lt;BR /&gt;&lt;BR /&gt;P:S Arun I need to delete the log files after I genereated the log of what its going to remove....&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Raf</description>
      <pubDate>Thu, 16 Feb 2006 00:37:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732615#M786351</guid>
      <dc:creator>Becke</dc:creator>
      <dc:date>2006-02-16T00:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732616#M786352</link>
      <description>Raf,&lt;BR /&gt;&lt;BR /&gt;You can go with shell built-in utility like find as,&lt;BR /&gt;&lt;BR /&gt;find /var/spool/uv/test -name "u*" -mtime +7 -exec rm -i {} \;&lt;BR /&gt;&lt;BR /&gt;It will ask your input to delete. If you don't want then remove that -i option.&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu</description>
      <pubDate>Thu, 16 Feb 2006 05:04:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732616#M786352</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-02-16T05:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732617#M786353</link>
      <description>More better,&lt;BR /&gt;&lt;BR /&gt;find /var/spool/uv/test -name "u*" -type f -mtime +7 -print | xargs rm -f&lt;BR /&gt;&lt;BR /&gt;--&lt;BR /&gt;Muthu&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Feb 2006 05:07:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732617#M786353</guid>
      <dc:creator>Muthukumar_5</dc:creator>
      <dc:date>2006-02-16T05:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732618#M786354</link>
      <description>Hi Raf, &lt;BR /&gt;&lt;BR /&gt;Using "find" and deleting will be another way of doing it. &lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Thu, 16 Feb 2006 05:11:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732618#M786354</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-16T05:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732619#M786355</link>
      <description>A very good link, &lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://dunedin.lug.net.nz/forums/showthread.php?t=40730" target="_blank"&gt;http://dunedin.lug.net.nz/forums/showthread.php?t=40730&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Thu, 16 Feb 2006 05:14:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732619#M786355</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-16T05:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732620#M786356</link>
      <description>Hi Raf,&lt;BR /&gt;&lt;BR /&gt;for an alternative solution, please see also:&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1001861" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1001861&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;hope this helps too!&lt;BR /&gt;&lt;BR /&gt;kind regards&lt;BR /&gt;yogeeraj</description>
      <pubDate>Thu, 16 Feb 2006 05:50:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732620#M786356</guid>
      <dc:creator>Yogeeraj_1</dc:creator>
      <dc:date>2006-02-16T05:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732621#M786357</link>
      <description>&lt;BR /&gt;&amp;gt;&amp;gt; your latest post didn't help me but the very first one did...&lt;BR /&gt;&lt;BR /&gt;It did. You are just not quite ready to recognize it.&lt;BR /&gt;Check back after a few days/weeks more of playing with perl &lt;BR /&gt;&lt;BR /&gt;:-)&lt;BR /&gt;:-)&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Feb 2006 06:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732621#M786357</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-02-16T06:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732622#M786358</link>
      <description>Hi (again) Raf:&lt;BR /&gt;&lt;BR /&gt;Hein has provided you some excellent guidelines to follow now and as you progress.  I agree with hime when he says to check back after a bit more "playing".&lt;BR /&gt;&lt;BR /&gt;Let me add one more piece of advice at this point.&lt;BR /&gt;&lt;BR /&gt;If you are writing anything more than (perhaps) a one-line command line script, begin with:&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;&lt;BR /&gt;If you are writing one-line command line scripts, at least add the '-w' switch (the less robust version of the 'warnings' pragma.&lt;BR /&gt;&lt;BR /&gt;You will save yourself countless hours of debugging, unnecessary repetitions of testing and possibly protect yourself from very costly mistakes!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 16 Feb 2006 08:05:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732622#M786358</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-02-16T08:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732623#M786359</link>
      <description>&lt;BR /&gt; Hi Hein and James,&lt;BR /&gt;&lt;BR /&gt; I really appreciate your help guys, after playing with the script bit more, I was able to get it working O.K...&lt;BR /&gt;&lt;BR /&gt; Its great to see that we have a great team here and everyone is quite happy to share their knowledge with others...By the do u guys know any good perl forum that I can join??????&lt;BR /&gt;&lt;BR /&gt; PS: Arun I'm trying to learn perl, so I don't want to write shell script commands to perform this task....Thanks everyone for always responding.....I will now assign more points&lt;BR /&gt;&lt;BR /&gt; Cheers,&lt;BR /&gt; Raf</description>
      <pubDate>Thu, 16 Feb 2006 19:35:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732623#M786359</guid>
      <dc:creator>Becke</dc:creator>
      <dc:date>2006-02-16T19:35:45Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732624#M786360</link>
      <description>Hi (again) Raf:&lt;BR /&gt;&lt;BR /&gt;I'm happy that we were able to help you.&lt;BR /&gt;&lt;BR /&gt;You will find these sites very informative:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perlmonks.org/" target="_blank"&gt;http://www.perlmonks.org/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.cpan.org/" target="_blank"&gt;http://www.cpan.org/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perl.com/" target="_blank"&gt;http://www.perl.com/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.perl.org/" target="_blank"&gt;http://www.perl.org/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy the journey!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 16 Feb 2006 19:43:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732624#M786360</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-02-16T19:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732625#M786361</link>
      <description>&lt;BR /&gt; Hi James,&lt;BR /&gt;&lt;BR /&gt; Thanks for the further info..I might be bothering you guys in the near future to get some occasional help in perl...I'm extremely keen to become a competent perl programmer:)...&lt;BR /&gt;&lt;BR /&gt; Many Regards,&lt;BR /&gt; Raf&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 16 Feb 2006 20:01:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732625#M786361</guid>
      <dc:creator>Becke</dc:creator>
      <dc:date>2006-02-16T20:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732626#M786362</link>
      <description>Hi Raf, &lt;BR /&gt;&lt;BR /&gt;Some more interesting Perl sites,&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://learn.perl.org/library/beginning_perl/" target="_blank"&gt;http://learn.perl.org/library/beginning_perl/&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://unix.org.ua/orelly/perl/index.htm" target="_blank"&gt;http://unix.org.ua/orelly/perl/index.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;-Arun</description>
      <pubDate>Thu, 16 Feb 2006 23:07:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732626#M786362</guid>
      <dc:creator>Arunvijai_4</dc:creator>
      <dc:date>2006-02-16T23:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Perl Code help to clean 7 days old log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732627#M786363</link>
      <description>&lt;BR /&gt; Hi Hein and James,&lt;BR /&gt;&lt;BR /&gt; I need your help again, although I have got the script working but i really need to change my code, as I don't want to use -M (match operator) and glob funtion in my code.&lt;BR /&gt;&lt;BR /&gt; Could you guys please correct my code below so I can use 'OPENDIR' function, instead of using 'glob' and also I want to use the "Time::Local" module...&lt;BR /&gt;&lt;BR /&gt;I still need to delete files older than seven days...Please help as its urgent...&lt;BR /&gt;Below is my code again, please correct it.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;foreach (glob("*")) { #instead of this I wanna use OPENDIR funtion here# &lt;BR /&gt;print; &lt;BR /&gt;my $age = -M ; #I don't want to use -M operator to match..Please correct it#&lt;BR /&gt;my $logfile = "/var/spool/cleanlogs.out"; &lt;BR /&gt;if ($age &amp;gt; 7) { #This statement will be changed once u correct it#&lt;BR /&gt;&lt;BR /&gt;OPEN (STDOUT, "&amp;gt;&amp;gt;$logfile"); #I dont want to use 'STDOUT' to send the output to a file,so this has to be changed, please correct this as well'#.&lt;BR /&gt;&lt;BR /&gt;print " IS OVER 7 days old\n"; &lt;BR /&gt;} else { &lt;BR /&gt;print " is ",int($age)," days old\n";&lt;BR /&gt;CLOSE (STDOUT); &lt;BR /&gt;} &lt;BR /&gt;} &lt;BR /&gt;</description>
      <pubDate>Thu, 16 Feb 2006 23:13:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/perl-code-help-to-clean-7-days-old-log-files/m-p/3732627#M786363</guid>
      <dc:creator>Becke</dc:creator>
      <dc:date>2006-02-16T23:13:17Z</dc:date>
    </item>
  </channel>
</rss>

