Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Well, what efforts have you made so far to try to solve these easy tasks?

Googling question 1 with the following reasonable search query "perl find current path", I get this page: https://www.google.fr/search?q=perl+find+current+path&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:fr:official&client=firefox-a&channel=sb&gfe_rd=cr&ei=qQ19U7bGI4GB8QfxroHoBA. The very first link (Cwd) will tell you about the Cwd module and getcwd (get current working directory) function that should help you solve question 1. Everything is explained, but if you need help to use this module, please show what you have attempted and tell us where it fails to give you what you want.

For question 2, you could possibly use the glob function to retrieve a list of directory entries, use the -d file test operator to find out if it is a directory, and to use the glob function again on that sub-directory to find the entries there. Then use the -s file test operator to find the size of each one. Finding the largest one should be easy relatively with a little bit of thinking.

OK, I have given you a few clues, I hope they will help you.

There are some modules that can do part of the work for you, but, in your case, I would probably recommend that you try to do it fully by yourself: you are obviously a beginner, you really need to write programs and think the whole process by yourself.

Once again, if you show some attempted code, many monks on this site, including myself, will be more than happy to help you. But we need to see your code, not only to verify that you are really trying (although this is part of the expectation), but more importantly because we need to see your code to know at which level you stand and what you need to learn or where you need guidance.

Sorry if my post is demanding things from you, but learning how to develop programs is a real challenge and requires some real work. We can help you solve specific problems and point to possible mistakes, we can't do the work for you. I could easily write the solution for you (it might take me less time than what I spent writing this detailed answer), but you would most probably not learn anything useful from it. I hope you are appreciating that I am trying to help you the best way.


In reply to Re: Advice/help with beginner script (file sorting, execute command line command) by Laurent_R
in thread Advice/help with beginner script (file sorting, execute command line command) by UserMane

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (7)
As of 2024-03-28 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found