In your first snippet, one problem could be where "$storyfile" comes from. Is a portion of it coming from a source that taint mode would frown upon? That's my thought; that you'e accepting at least a portion of $storyfile from a source that could be considered tainted (or taintable).
In your second snippet, you're not even opening the file for output; you're opening it for input. And "Could not write..." is fooling you; it's your own error message. It should actually say, "Could not read from..." (since you're opening the file for reading in that second snippet). And the reason it's failing to open for reading is probably that it doesn't exist yet since you haven't written it yet.
By the way; use the three-arg version of open: open STORY, '>', $storyfile or die .....
Oh, that reminds me of another problem; in your first snippet you're using the wrong "or"; since there aren't any parens around the open argument list, you need to use "or" instead of "||", or else you get into precedence trouble.
Dave
In reply to Re: Having trouble creating a text file
by davido
in thread Having trouble creating a text file
by greymoose
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |