Why does applying the perl code
undef $/; # read in entire file or STDIN
$_ = <>;
s|<head>.*<\head>|<head>...</head>|s;
applied to a text file containing
<head>[anything]</head>
produce
...
and not
<head>...</head>
?
When the '<' characters in the substitution REPLACE field are omitted, as in
s|<head>.*</head>|head>.../head>|s;
the substitution produces
head>...end>
The '<' character makes the difference, but I can find no explanation of why.
How does one produce a '<' in the substitution result?