samirpatry has asked for the wisdom of the Perl Monks concerning the following question:


i have created a program which has execute in command prompt like perl mytool.pl .after executing this it will show an option to the user like
Please follow the instuction to run the testcase</br> -s <input_File_Name> -o <output_File_Name>

And user enter this like

-s test.txt -o log.txt

So i need a easy way so that it read each option and put it in diffrent variable ,so that i will execute each option separetely.

20061004 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips

Replies are listed 'Best First'.
Re: How to create a option menu????
by xdg (Monsignor) on Oct 04, 2006 at 13:32 UTC

    See Getopt::Long. There are many other option processing modules but that one is included with Perl and is "standard". You may also like Getopt::Std for an even simpler approach.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.