Skip to content

Instantly share code, notes, and snippets.

@DavidSzczesniak
Last active January 10, 2018 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidSzczesniak/b8c83d11c63b4636bf9204c1eb633a8a to your computer and use it in GitHub Desktop.
Save DavidSzczesniak/b8c83d11c63b4636bf9204c1eb633a8a to your computer and use it in GitHub Desktop.
These can be named anything you want for the most part; using letters, digits and under-scores (can't start with digit). However, there are some common ones that Perl has created. These are STDIN, STDOUT, STDERR, DATA, ARGV, ARGVOUT. This will detail the main three though.
\!h STDIN & STDOUT - the barebones
STDIN - your program should blindy read from this (input).
STDOUT - and blindly write to this (output).
$ ./your_program <dino >wilma # shell prompt command
The program's input should be read from the file 'dino' amd the output should go to the file 'wilma'
\!h STDERR
This can be used to redirect any errors to wherever the user desires, though by default they go to that user's display screen.
Sending the errors to a file with a shell command:
$ netstat | ./your_program 2>/tmp/my_errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment