in reply to Re^3: Appending strings
in thread Appending strings

Thanks John, that works, you're awesome! By the way, what does this line do? qr{(?:@excl)};

Replies are listed 'Best First'.
Re^5: Appending strings
by AnomalousMonk (Archbishop) on Mar 12, 2016 at 03:34 UTC
    ... what does this line do? qr{(?:@excl)};

    That statement, which by the way is really
        qr{(?x) (?: @excl ) \b};
    interpolates the strings that have been assigned to the  @excl array into a pre-compiled  qr// "regex object" (see Regexp Quote-Like Operators). The interpolation is under the control of the  $" special variable (see perlvar), which has been assigned the  '|' string, which is the regex alternation operator. The full effect of the block in which this statement executes can easily be seen:

    c:\@Work\Perl>perl -wMstrict -le "my $rxExcl = do { my @excl = qw{ if else 1'b0 end }; local $\" = q{^|}; qr{(?x) (?: @excl ) \b}; }; print $rxExcl; " (?^:(?x) (?: if|else|1'b0|end ) \b)


    Give a man a fish:  <%-{-{-{-<