Make copies and pass them in instead.
This is as easy as just passing "$1" instead of $1.
| [reply] [Watch: Dir/Any] |
The general rule is never, ever pass in $1 and its friends, as they're terribly ephemeral. Make copies and pass them in instead.
That's a good general rule but I'd still go for belt and braces.
If the API of a function doesn't say it treats its arguments as lvalues then it is good practice to make copies of the elements from @_. If you need to do any regex processing before you unpack @_ then wrap it in a block.
| [reply] [Watch: Dir/Any] |