aufrank and all responders; Thank you for the explaination and suggestions on asking questions. All of these responses will be of some help, even the oneliner. Although I understand the concepts of opening and reading from file, understanding how the array is created, and actually substuting the elements into my code is vague to me. I have included my code so that my question is more explicit. I am trying to delete the files in the reports directory that are x days old. I have 67 directories under /opt/web that all have reports directories. I would like to place all of these paths into a text file to be read into the array, and have the following actions performed.
# open the directory for reading chdir "/opt/web/hr83tst/reports"; opendir(REP, "/opt/web/hr83tst/reports") || die "Cannot open the dire +ctory /opt/web/hr83/reports $! "; open(remlog,">/Scripts/dir-removed.log"); # open a file to keep as a +log of directories removed. print remlog "Directories removed this date : ",`date`, "\n"; # list the contents of the directory. These should be directories. while ($name = readdir(REP)) { if (-M $name >= 10) { print "$name\n" unless($name eq "images"); print remlog "$name\n" unless($name eq "images"); `rm -r $name` unless($name eq "images"); # THIS WILL REMOVE THE D +IRECTORY AND ALL OF ITS subdirectories and Files. } } close remlog; closedir(REP)

In reply to Re: Re: Creating an array from a text file by mikevanhoff
in thread Creating an array from a text file by mikevanhoff

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.