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

Re: [perl #128302] split docs don't mention pattern modifiers

Thread Previous | Thread Next
From:
Abigail
Date:
May 31, 2016 20:53
Subject:
Re: [perl #128302] split docs don't mention pattern modifiers
Message ID:
20160531205505.GA24844@almanda.fritz.box
On Tue, May 31, 2016 at 09:06:57AM -0700, Smylers wrote:
> # New Ticket Created by  Smylers 
> # Please include the string:  [perl #128302]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=128302 >
> 
> 
> 
> This is a bug report for perl from Smylers@stripey.com,
> generated with the help of perlbug 1.40 running under perl 5.25.2.
> 
> 
> -----------------------------------------------------------------
> perldoc -f split doesn't state that split /PATTERN/ can use pattern
> modifier flags, but it seems that it can:
> 
>   ./perl -Ilib -E 'say foreach split /a b # c/, q[0aB1a b # c2a B # c 3]'
>   0aB1
>   2a B # c 3
> 
>   ./perl -Ilib -E 'say foreach split /a b # c/ix, q[0aB1a b # c2a B # c 3]'
>   0
>   1a b # c2a B # c 3
> 
> This should be included in split's documention.
> 
> Are all the qr/PATTERN/ flags also valid on split? (With the already
> documented exception that /^/ implies /^/m anyway.)


I think they are, but some warn. For instance:

  $ perl -wE 'our @a = split /f/g, "foo"'
  Use of /g modifier is meaningless in split at -e line 1.
  $


But I haven't checked all of them.



Abigail

Thread Previous | Thread Next


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