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
foreach (@story) {
s/\[(.*?)\]/$hash{$1}/g;
print;
}
or, for more fun
map { s/\[(.*?)\]/$hash{$1}/g; print } (@story);
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:)