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*(°.*?°|\S+)/;
where the ° character would mean,
Don't capture the previous
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) =
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. It
The ° character doesn't have any special meaning,
that's why I choosed it in the above example.
However, it also symbolizes a little capturing
and as it isn't filled,
it could really symbolize an uncapturing.
Interesting idea. I'm not sure if I agree with it yet. However, I don't
agree
Luke Palmer wrote at Thu, 29 Aug 2002 15:21:57 +0200:
The ° character doesn't have any special meaning,
that's why I choosed it in the above example.
However, it also symbolizes a little capturing
and as it isn't filled,
it could really symbolize an uncapturing.
Interesting idea. I'm
Don't forget you can parameterize rules with subrules. I don't see
any reason you couldn't write a
pick (.*?) | (\S+)
kind of rule and do whatever you like with the submatched bits.
Larry
In a message dated 27 Aug 2002, Uri Guttman writes:
LW == Larry Wall [EMAIL PROTECTED] writes:
LW On 27 Aug 2002, Uri Guttman wrote: : and quoteline might even
LW default to for its delim which would make : that line:
LW :
LW : my ($fields) = /(quotelike|\S+)/;
LW That just
On Wed, 2002-08-28 at 03:23, Trey Harris wrote:
Note--no parens around $field. We're not capturing here, not in the
Perl 5 sense, anyway.
When a pattern consisting of only a named rule invokation (possibly
quantified) matches, it returns the result object, which in boolean
context
In a message dated 28 Aug 2002, Aaron Sherman writes:
Ok, just to be certain:
$_ = 0;
my $zilch = /0/ || 1;
Is $zilch C0 or 8?
8? How do you get 8? You'd get a result object which stringified was 0
and booleanfied was true. So here, you'd get a result object vaguely
Piers Cawley wrote:
Uri Guttman [EMAIL PROTECTED] writes:
{...]
couldn't that be reduced to:
m{^\s* $stuff := [ (.*?) | (\S+) ] };
the | will only return one of the grabbed chunks and the result of
the [] group would be assigned to $stuff.
Hmm... is this the first Perl 6 golf post?
On 28 Aug 2002 at 16:04, Steffen Mueller wrote:
Piers Cawley wrote:
Uri Guttman [EMAIL PROTECTED] writes:
... regex code ...
Hmm... is this the first Perl 6 golf post?
Well, no, for two reasons:
a) There's whitespace.
b) The time's not quite ready for Perl6 golf because Larry's the
On Tue, Aug 27, 2002 at 08:59:09PM -0400, Uri Guttman wrote:
LW == Larry Wall [EMAIL PROTECTED] writes:
LW On 27 Aug 2002, Uri Guttman wrote: : and quoteline might even
LW default to for its delim which would make : that line:
LW :
LW : my ($fields) = /(quotelike|\S+)/;
LW
On Thu, Aug 29, 2002 at 12:00:55AM +0300, Markus Laire wrote:
And I'm definitely going to try any future PerlGolf challenges also
in perl6.
Is it considered better if perl6 use more characters than perl5? (ie
implying probably less line noise)
or less (getting your job done more tersely?)
It
Nicholas Clark wrote:
On Thu, Aug 29, 2002 at 12:00:55AM +0300, Markus Laire wrote:
And I'm definitely going to try any future PerlGolf challenges also
in perl6.
Is it considered better if perl6 use more characters than perl5? (ie
implying probably less line noise)
or less (getting your
On Thu, 29 Aug 2002, Markus Laire wrote:
(only 32bit numbers, modulo not fully working, no capturing regexps,
)
Where does modulo break?
/s
On Thu, 29 Aug 2002, Steffen Mueller wrote:
Nicholas Clark wrote:
On Thu, Aug 29, 2002 at 12:00:55AM +0300, Markus Laire wrote:
And I'm definitely going to try any future PerlGolf challenges also
in perl6.
Is it considered better if perl6 use more characters than perl5? (ie
implying
I just wrote this code in Perl5:
$stuff = (defined($1)?$1:$2) if /^\s*(?:(.*?)|(\S+))/;
This is a common practice for me when I parse configuration and data
files whose formats I define. It's nice to be able to quote fields that
have spaces, and this is an easy way to parse the result.
In
On 27 Aug 2002, Aaron Sherman wrote:
: I just wrote this code in Perl5:
:
: $stuff = (defined($1)?$1:$2) if /^\s*(?:(.*?)|(\S+))/;
:
: This is a common practice for me when I parse configuration and data
: files whose formats I define. It's nice to be able to quote fields that
: have
TH == Trey Harris [EMAIL PROTECTED] writes:
TH In a message dated 27 Aug 2002, Uri Guttman writes:
m{^\s* $stuff := [ (.*?) | (\S+) ] };
TH Or, how about
TH my ($fields) = /(CORE::quotelike(delim = '')|\S+)/;
wouldn't quotelike automatically be inherited from the CORE:: rules like
On 27 Aug 2002, Uri Guttman wrote:
: LW == Larry Wall [EMAIL PROTECTED] writes:
: LW m{^\s*[
: LW $stuff:=(.*?) |
: LW $stuff:=(\S+)
: LW ]};
:
: couldn't that be reduced to:
:
: m{^\s* $stuff := [ (.*?) | (\S+) ] };
:
: the | will only return one of the
On 27 Aug 2002, Uri Guttman wrote:
: and quoteline might even default to for its delim which would make
: that line:
:
: my ($fields) = /(quotelike|\S+)/;
That just looks like:
my $field = /shellword/;
Larry
LW == Larry Wall [EMAIL PROTECTED] writes:
LW On 27 Aug 2002, Uri Guttman wrote: : and quoteline might even
LW default to for its delim which would make : that line:
LW :
LW : my ($fields) = /(quotelike|\S+)/;
LW That just looks like:
LW my $field = /shellword/;
where is the
22 matches
Mail list logo