Help with Getopt::Std

I am working on a script that lists files in a directory with a few file attributes depending on what option the user specifies at the command prompt. The script uses Getopt::Std and takes two switches.

The first switch allows the user to specify a directory, the second switch gives a long listing of the specified directory. For the most part, the switches work, and I get the required output, but if either switch is used and no argument is given, I need the script to use the current directory for the script. I am not sure how to specify that in the code.

I am using a regular IF statment now, just looking for tips on how to implement what I need.

I am doing very basic like this for now:

if ($option_d) {
    code
     code
    }

I just wrote this amazing script.

Check it:

ls /some/directory

OR, for the long listing:

ls -l /some/directory

OR, for the current directory:

ls

ORRR, for a long listing of the current directory:

ls -l

If that isn't really want you wanted to accomplish, please be more specific. Based on your description of the problem, my neato "script" will solve the problem you described.

Thank you, you have proven that you are internet-awesome.

Good job.

You're welcome. I'm glad that I could assist.