Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command line arguments 1

Status
Not open for further replies.

ailse

Programmer
Jan 20, 2004
79
GB
Hi there,

I am writing a small script to search a text database (data_file.txt) that I have already read into a hash of arrays. My command line should look like:

Code:
./search.pl -i data_file.txt -k search terms

my problem is that there is usually going to be more than one word following the -k, for example:

Code:
./search.pl -i data_file.txt -k alcohol dehydrogenase

currently this only matches records that contain 'alcohol' as opposed to the whole phrase 'alcohol dehydrogenase' - is it possible to get the getopt module to store everything that follows the -k flag into the $opts{k} variable, rather than just the first word?

Many thanks :)
 
thanks for that - tried it with quotes and it's worked how i want it to now :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top