Re: interesting regex delimiters

2017-02-25 Thread Andrew Solomon
Thanks Chas., that's interesting! Here's my summary of what I've learnt from this: 1. The regex $foo =~ "\Asome string\Z" is equivalent to $bar = "\Asome string\Z"; # ends up as 'Asome stringB' with a warning $foo =~ /$bar/; i.e evaluate the string first and then stick it into the regex delimi

Re: interesting regex delimiters

2017-02-24 Thread Chas. Owens
Be careful, it isn't actually a regex; it is a string that will be compiled to a regex. You can see one difference here: #!/usr/bin/perl use v5.20; use warnings; say "string matches:"; for my $s ("foo", "AfooZ") { say "\t$s: ", $s =~ "\Afoo\Z" ? "true" : "false"; } say "regex matches:"; for my

Re: interesting regex delimiters

2017-02-23 Thread Andrew Solomon
Thanks Uri! On Thu, Feb 23, 2017 at 10:32 PM, Uri Guttman wrote: > On 02/23/2017 05:19 PM, Andrew Solomon wrote: > >> Running Perl 18.2 I was surprised to discover that I can use single and >> double quotes as regex delimiters without the 'm' operator. >> >> For example, instead of writing >> >>

Re: interesting regex delimiters

2017-02-23 Thread Uri Guttman
On 02/23/2017 05:19 PM, Andrew Solomon wrote: Running Perl 18.2 I was surprised to discover that I can use single and double quotes as regex delimiters without the 'm' operator. For example, instead of writing "/usr/bin/perl" =~ m"/perl" I can just write "/usr/bin/perl" =~ "/perl" C