If you don't have perl installed on your system then you can download from these following links:
For more download options look for following link:
Blog for Perl scripting, batch file creation, windows mobile ( Pocket PC, Smart Phones), android mobile related issues & Usage of VI editor. Please subscribe to Blog FEED to get the latest updates on your E-mail.
Representation | Class | Description |
u | User | Owner |
g | Group | Members of file group |
o | Others | Neither owner nor group |
a | All | Everyone |
Octal | System | Description |
0 | --- | No permission |
1 | --x | execute |
2 | -w- | write |
3 | -wx | Write and execute |
4 | r-- | Read |
5 | r-x | Read and execute |
6 | rw- | Read and write |
7 | rwx | Read, write and execute |
. if none of these is set then does nothing.use File::Copy;
# To Captures both STDOUT and STDERR, Redirects STDERR(2) to STDOUT(1)
$output = `cmd 2>&1`;
# Captures Only STDOUT, STDERR is discarded ( STDERR is redirected to null)
$output = `cmd 2>/dev/null`;
# To capture only STDERR, and discard STDOUT, Order is Important
$output = `cmd 2>&1 1>/dev/null`;
Using this following command you can redirect STDOUT and STDERR outputs to different files.
system("perl test.pl 1>test.stdout 2>test.stderr"); # take copies of the file descriptors open(OLDOUT, ">&STDOUT"); open(OLDERR, ">&STDERR"); # redirect stdout and stderr open(STDOUT, "> /tmp/program.out") or die "Can't redirect stdout: $!"; open(STDERR, ">&STDOUT") or die "Can't dup stdout: $!"; # run the program system($joe_random_program); # close the redirected filehandles close(STDOUT) or die "Can't close STDOUT: $!"; close(STDERR) or die "Can't close STDERR: $!"; # restore stdout and stderr open(STDERR, ">&OLDERR") or die "Can't restore stderr: $!"; open(STDOUT, ">&OLDOUT") or die "Can't restore stdout: $!"; # avoid leaks by closing the independent copies close(OLDOUT) or die "Can't close OLDOUT: $!"; close(OLDERR) or die "Can't close OLDERR: $!";