So you need to create a menu of the files in the current directory with the option to change directory to any sub-directory in the current directory or go up a level and the possibility of selecting a file in the current directory.
Something like Norton commander of old? or Midnight commander (mc) on Linux?
Break your problem into manageable bits.
- Write a menu function which takes an array, displays the contents with an identifier and returns the value associated with the identifier the user chooses
- Use readdir on the current directory to call the menu sub above with the contents of the curent directory
- If the returned value is a directory cd to it and repeat the process
- until the returned value is a file, in which case select it for processing.
- Process file.
Each of the steps above is straightforward, try coding them up and, if you have a problem come back to us with your code, the inputs and the errors you are seeing.
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.