}
-while (my $line = <>) {
+while (<>)) {
# Only handle lines with highlight commands.
- if ($line =~ /^\s*\bhi(?:ghlight)?\b/) {
- foreach my $setting ($line =~ m/\bcterm(?:fg|bg)?=\S+/g) {
+ if (/^\s*\bhi(?:ghlight)?\b/) {
+ foreach my $setting (m/\bcterm(?:fg|bg)?=\S+/g) {
my ($name, $value) = split /=/, $setting;
my $gui_name = $name;
}
# Update existing value.
- if ($line =~ /\b\Q$gui_name\E=/) {
- $line =~ s/\Q$gui_name\E=\S+/$gui_name=$new_value/;
+ if (/\b\Q$gui_name\E=/) {
+ s/\Q$gui_name\E=\S+/$gui_name=$new_value/;
# Append at the end of the line.
} else {
- $line =~ s/\n/ $gui_name=$new_value\n/;
+ s/\n/ $gui_name=$new_value\n/;
}
}
}
- print $line;
+ print;
}