> Hi, > i am using the Getopt::Std package in my code. > > > use Getopt::Std; > > getopts('s:'); > > $a = $opt_s > > > this is how i run my program from command line " > > > my_program.pl -s pattern > > now if "pattern" is something like abcd[12] how do i > make my program accept the index 12 as a part of the > string for option -s ? > > i would appreciate if anybody can help me on this. >
I believe your problem is that the shell is trying to interpret the [12] itself rather than letting it pass through as an argument string. Try quoting the whole string on the command line: my_program -s 'abcd[12]' tcsh appears to have this problem providing a 'No match', however bash does what you expect. You may also want to check out Getopt::Long for a more robust interface and documentation. And I assume your snippet dropped "use strict" and "use warnings" for brevity? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>