in reply to <<EOF syntax for reading into string
I notice that you have global $x appearing again in the code of readstring(). That will replace $x whenever readstring is called, whether or not you assign to it. Declaring the lexical my $x = <<EOF; in the first line of the sub will fix that.
You can do without temporary variables entirely with the following oddity,
The empty prototype is a hint to the compiler that readstring returns a constant value and can be evaluated during compilation. I single-quoted the heredoc end tag to emphasize that there is no variable interpolation to happen. ("unquoted" is only true in a typographic sense - heredocs can employ any of perl's flavors of quoting)sub readstring () { <<'EOF'; here is my unquoted multiline string EOF }
After Compline,
Zaxo
|
|---|