[EMAIL PROTECTED] wrote, on Friday, May 05, 2000 13:57
:       D:\Program Files\Microsoft Visual 
: Studio\Common\IDE\IDE98\devenv.exe
: "%1"
: 
: I would like to extract just the first part of the string (the path),
: dropping the argument ("%1"). Any ideas on how I can parse it?

You could split on whitespace to an array (my @arr = split ' ';),
and then pop off the last element (the argument), assuming the arg
had no spaces, and then rejoin on space; but that might be
problematic, especially if there *could be* a space in the
argument.

Do you know for sure there will never be a double-quote '"' in the
path? How about:

s/".*$//;

That should be wicked-fast for a regex. You'll have whitespace at
the end of the path, though; but that probably wouldn't be a problem
(you're going to pass this path to "open" or something?). If it is,
make that

s/\s+".*$//;

which will be slower.

Joe

==============================================================
          Joseph P. Discenza, Sr. Programmer/Analyst
               mailto:[EMAIL PROTECTED]
 
          Carleton Inc.   http://www.carletoninc.com
          219.243.6040 ext. 300    fax: 219.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years


---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to