in reply to Understanding this regex

Simpler:
sub get_dn { local#($filename); @ARGV = @_; map# <>, #gx, m# (<CN=.*?>) #gx, <>, } my($dn1) = get_dn('crap');

Replies are listed 'Best First'.
Re^2: Understanding this regex
by Anonymous Monk on Jun 05, 2013 at 05:00 UTC

    Simpler:

    Sure, also riskier (more dangerous) :) also you didn't local-ize $^I

    Also, '#' is the worst choice for a m//atch or s///ubstitution delimiter, it means you can't use # to comment your regular expression

    Never use '#' '$' '@' and '\\' as delimiters, they're the worst possible choices