In shell 2> redirection of fileno 2 means. Fileno 2 is always what the program sees as stderr. Similarly, fileno 0 is stdin, and fileno 1 is stdout. So, when you say 2>&1 , you are telling the shell to redirect stderr (fileno 2) to stdout (fileno 1). Since the backticks operator uses the shell to run the command you specify, you can use the shell redirection, so
my $foo = `curl yadda yadda 2>&1`;
tells curl to redirect its output to stdout, and since the backtick statement catches stdout, you get what you were looking for.
Chas. Owens
source share