Normally on unix-like systems a process is started with three open file descriptors. STDIN, STDOUT, STDERR. (Think "standard in", "standard out", "standard error".) Each file descriptor has a traditional use.
Programs read from STDIN. Normally this means the program reads from the console but it is often from a pipe.
Programs write the normal output to STDOUT. Normally this means when the program writes to STDOUT it goes to the console but it is often sent to a pipe.
Programs write error related output to STDERR. Again normally this means when the program writes to STDERR it goes to the console but it is often sent to a pipe.
Note that there is no requirement that the programs you write report errors to STDERR but most unix programs do. The reason is someone might throw away STDOUT because they don't actually want to see it but if an error shows up they do want to see it. For example "some_program > /dev/null".
To see the difference run this program:
#!/usr/bin/perl -w
use strict;
print STDOUT "this is stdout\n";
print STDERR "this is stderr\n";
STDOUT is given the number 1 and STDERR the number 2. (STDIN is number 0, ie zero.) These BASH shell commands will show you what happens when you redirect the different files to the junk bin "/dev/null".
$ ./stdout-stderr.pl 1>/dev/null
this is stderr
$ ./stdout-stderr.pl 2>/dev/null
this is stdout
If you are new to unix programming you should have a look at the
Unix Programming Frequently Asked Questions.