What's stopping you? The answer to your question lies in you trying to understand the code you have. You already have the file name in your $file variable. You can get information on files using the -X family of operators, but you should know that already since your code contains -f. stat might also be helpful.

I find it odd that you say it's working now, as I took your posted code, attempted to run it, and obtained the errors:

String found where operator expected at fluff.pl line 35, near ") "Dir +ectories: $directory_count |"" (Missing operator before "Directories: $directory_count |"?) print (...) interpreted as function at fluff.pl line 36. String found where operator expected at fluff.pl line 36, near ") "Fil +es: $file_count\n"" (Missing operator before "Files: $file_count\n"?) syntax error at fluff.pl line 35, near "$OUTF) " syntax error at fluff.pl line 36, near ") "Files: $file_count\n"" Execution of fluff.pl aborted due to compilation errors.

I can also spot a number of other issues that would be caught by strict and warnings, as you claim to have implemented Re^2: Perl Script to count files and directories is not working.. As an internet programming forum, PerlMonks is ridiculously respectful and helpful to the neophyte. We do not have patience for people who show no effort. I highly recommend you read How To Ask Questions The Smart Way and meditate on it before posting again.


In reply to Re^3: log file in perl. by kennethk
in thread log file in perl. by manu_06

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.