sub zapwrap { my ($this, $next) = @_; return $this =~ m{ ^ \# # '#' at the beginning of the string ( [\#=] ) # a '#' or an '=' (saved to $1) \1* # that character 0 or more times $ # end of line }x and $next =~ m{ ^ # beginning of string $1+ # that character 1 or more times $ # end of string }x; }