Re: Capturing alternations (was Re: Hypothetical synonyms)

2002-08-28 Thread Damian Conway
Piers wrote: > Not exactly DWIM, but how about: > > my $stuff = /^\s* [ "(.*?)" | (\S+) ] : { $foo := $+ }/; > > Assuming $+ means 'the last capture group matched' as it does now. > Or just: my $stuff = /^\s* [ "$foo:=(.*?)" | $foo:=(\S+) ]/; BTW, that doesn't actually *do* the match

Capturing alternations (was Re: Hypothetical synonyms)

2002-08-28 Thread Trey Harris
In a message dated Thu, 29 Aug 2002, Janek Schleicher writes: > Aaron Sherman wrote at Wed, 28 Aug 2002 00:34:15 +0200: > > > $stuff = (defined($1)?$1:$2) if /^\s*(?:"(.*?)"|(\S+))/; > > It gives me the idea of a missing feature: > > What really should be expressed is: > > my ($stuff) = /^\s*