open() and pipes quiz

IlyaM on 2003-10-14T12:09:30

What is the difference between these two lines (on Linux with Perl 5.8.x or 5.6.x). More precisely why does only first open die?

open(FH, '/doesnt/exist  2>&1 |') or die "Cannot pipe: $!";

open(FH, '/doesnt/exist\\  2>&1 |') or die "Cannot pipe: $!";

Hint if you have no idea: try to remove 2>&1 from command line.