in reply to regex substitution
my $text = << 'end_of_test'; Your child <child> is invited to come to our school. Your child's teacher will be <teacher>, and the class is held in <room>."; end_of_test my %hash = ('child' => 'mary', 'teacher' => 'mrs b', 'room' => '123'); print "Raw: $test\n"; $test =~ s[<(\w+)>] [defined($hash{$1}) ? $hash{$1} : warn]ieg; print "Processed: $test\n";
|
|---|