in reply to Perl bug or feature?
With either
$string2 =~ /^h(.*)/o;
or
$string2 =~ /^h(.*)/;
(i.e., either with or without the /o regex modifier), I get the same results for ActiveState 5.8.9 and Strawberries 5.10.1 and 5.12.0 (all running under Windoze 7) and as I would expect (after a little thought) given the documented behavior of the // empty regex:
>perl -wMstrict -le "my @strings = ('testing','','testing','testing'); foreach my $string (@strings) { print \"\nSTRING: $string\n\"; my $string2 = 'http'; $string2 =~ /^h(.*)/o; my $q = $string; my $test = 'testing'; warn $test =~ /\Q$q\E/; } " STRING: testing 1 at -e line 1. STRING: Warning: something's wrong at -e line 1. STRING: testing 1 at -e line 1. STRING: testing 1 at -e line 1.
|
|---|