in reply to Regexp syntax nuance question, storing $1 (code)
Another alternative is:
though I prefer the one proposed by japhy. Also note that if the repeated character has special meaning in a regular expression, then you'd need to use \Q$1\E in japhy's version. - tye (but my friends call me "Tye")sub zapwrap { my ($line, $next_line) = (@_); return undef unless $line =~ /^#(#+|=+)$/; my $c= quotemeta substr($1,0,1); return undef unless $next_line =~ /$c+/; return 1; }
|
|---|