use constant { TRUE => 1, FALSE => 0, }; #### $ perl -E 'my $x = "whateverstaticip_address=X"; say $x =~ /^.*static\s*ip_address=/ ? "YES" : "NO"' YES $ perl -E 'my $x = "whateverstaticip_address=X"; say $x =~ /^\s+static\sip_address=/ ? "YES" : "NO"' NO