?
Solved

Simple Getopt::Long Question

Posted on 2005-03-03
1
Medium Priority
?
264 Views
Last Modified: 2010-03-05
use Getopt::Long;

#Get command line parameters
GetOptions("City=s",\$City, "State=s",\$State);

print "City: $City\n";
print "State: $State\n";

If I call this using the following: Test.pl -City Boston -State MA

The output is correct
City: Boston
State: MA

BUT

If I use a city with a space for exampe: Test.pl -City New York -State NY

The output only grabs 'new' for the city name.
City: New
State: NY

How can I pass in a string with a space in it on the command line using GetOpt:Long?

Thanks!
0
Comment
Question by:maddhacker24
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 16

Accepted Solution

by:
manav_mathur earned 200 total points
ID: 13450306
Enclose the string on command line within quotes.

Manav
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question