How to redirect the STDERR to a variable in perl?

in my perl script

i tried the below statement

$result = `cleartool  rmstream -f $s1 1> /dev/null`;

so as to redirect then error messages,when i print the $result

,it seems to be Null.

$result = `cleartool rmstream -f $s1 2> /dev/null`;

You are jus redirecting the stderr to /dev/null, i want the error message to be stored in a variable

Try:

$result = `cleartool  rmstream -f $s1 2>&1 >/dev/null`;

And you can get a more detailed explanation in the FAQ: