in reply to An Elegance Question
Instead of using variables such as $noun1, $noun2, etc.,
you might want to consider encapsulating the values in a
hash ($hash{noun1}, $hash{noun2}, etc.) when reading them
in. This would first of all keep your namespace cleaner,
and secondly, would allow the foreach loop to be rewritten
as
or, for more funforeach (@story) { s/\[(.*?)\]/$hash{$1}/g; print; }
The same effect could be achieved with the variable names you're reading into now, but would require the use of symbolic references, the use of which would probably get you dragged out into the street and shot here:)map { s/\[(.*?)\]/$hash{$1}/g; print } (@story);
In Section
Seekers of Perl Wisdom