robert wrote:

>>s/"([^"]+) ([^"]+)"/$1\000$2/g;       
> 
> holy cow.  can you explain that substitution?   my brain just about
> popped.

It's just replacing the blank/space between two words with a binary 0
and losing the quotes.

Lyle didn't like that one cause it didn't handle mult spaces.

Here's another that handles mult spaces :

use strict;
use warnings;

$_ = 'one "two  three" "four five  six" seven eight';

# you could call a sub rather than doing it all in the second half
# of the substitute ($tmp is because you can't modify $1).

s/"([^"]+ +[^"]+)"/my $tmp = $1; $tmp =~ s! !\000!g; sprintf $tmp/eg;

my @a = split / +/;
foreach (@a) {
        s/\000/ /g;
        print "$_\n";
}

That should make Lyle happy.

>>__END__

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to