{ # block for local local $/ = ''; # paragraph mode path( $dhcpcdfile )->edit_lines( sub { if( m/ # match this: ^\s* # zero or more whitespace chars at line begin profile # followed by the word "profile" \s+ # one or more whitespace static_ # then "static_" $ip_params{interface} # the value for key "interface" in %ip_params \b # a word boundary .* # zero or more following chars \n # and a newline /mx # in a multiline block ) { # alter this section s/ # match and substitute ^\s* # zero or more whitespace chars at line begin static # word "static" \s+ # one or more whitespace chars (\w+) # a word (see perlre) captured in $1 = # equal sign \K # but keep what was matched so far .* # any following chars / # against $ip_params{$1} # the value of key $1 (see above) in hash %ip_params /gmx; # globally in a multiline block (for "x" see perlre) } # endif } # end of sub ); } # end of "local $/" block