develooper Front page | perl.perl5.porters | Postings from November 2016

Re: [perl #129277] [PATCH] addition to perlrecharclass about '$' as"special"

Thread Previous
From:
Abigail
Date:
November 11, 2016 10:10
Subject:
Re: [perl #129277] [PATCH] addition to perlrecharclass about '$' as"special"
Message ID:
20161111101407.GA1565@almanda.fritz.box
On Mon, Oct 17, 2016 at 07:44:39PM -0700, Karl Williamson via RT wrote:
> 
> How about the attached patch instead?
> 
> -- 
> Karl Williamson
> 
> ---
> via perlbug:  queue: perl5 status: open
> https://rt.perl.org/Ticket/Display.html?id=129277

> >From a6b63f4e4781c3ae0a4dc1e4ae0eedd98bb7e781 Mon Sep 17 00:00:00 2001
> From: Karl Williamson <khw@cpan.org>
> Date: Thu, 15 Sep 2016 21:52:44 -0600
> Subject: [PATCH] alternate patch for 129277
> 
> ---
>  pod/perlrecharclass.pod | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/pod/perlrecharclass.pod b/pod/perlrecharclass.pod
> index 89f4a7e..51ad3db 100644
> --- a/pod/perlrecharclass.pod
> +++ b/pod/perlrecharclass.pod
> @@ -512,7 +512,13 @@ is, characters that carry a special meaning like C<.>, C<*>, or C<(>) lose
>  their special meaning and can be used inside a character class without
>  the need to escape them. For instance, C<[()]> matches either an opening
>  parenthesis, or a closing parenthesis, and the parens inside the character
> -class don't group or capture.
> +class don't group or capture.  Beware that, unless the pattern is
> +enclosed in single-quotes, variable interpolation will take place before
> +the bracketed class is parsed:
> +
> + $, = "\t| ";
> + $a =~ m'[$,]';        # single-quotish: matches '$' or ','
> + $a =~ m/[$,]/;        # double-quotish: matches "\t", "|", or " "
>  
>  Characters that may carry a special meaning inside a character class are:
>  C<\>, C<^>, C<->, C<[> and C<]>, and are discussed below. They can be



Looks good to me.



Abigail

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About