Here is how I've done it in test files:
I can't remember where I first saw that, but I've kept it handy ever since.# Capture any STDERR output my $stderr = ''; local *STDERR; open STDERR, '>', \$stderr;
In reply to Re: capturing stderr of echo piped to a file
by boftx
in thread capturing stderr of echo piped to a file
by cebundy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |