BioPerl is a compilation of Perl modules that can be used to build bioinformatics-related Perl scripts. It is used, for example, in the development of source codes, standalone software/tools, and algorithms in bioinformatics programmes. Different modules are easy to instal and include, making it easier to perform different functions. Despite the fact that Python is commonly favoured over Perl, some bioinformatics software, such as the standalone version of 'alienomics', is written in Perl. Often it's a major problem for beginners to execute certain Unix/shell commands in Perl script, so it's hard to determine which feature is unique to a situation.
More at https://bioinformaticsonline.com/snippets/view/42919/perl-ipcopen2-module
2. exec””
syntax: exec "command";
3. Backticks “ or qx//
syntax: `command`;
syntax: qx/command/;
4. IPC::Open3
syntax: $output = open3(\*CHLD_IN, \*CHLD_OUT, \*CHLD_ERR, 'command arg1 arg2', 'optarg',...);
It is very similar to
IPC::Open2
with the capability to capture all three file handles of the process, i.e., STDIN, STDOUT, and STDERR. It can also be used with or without the shell. You can read about it more in the documentation: IPC::Open3.
$output = open3(my $o ut, my $in, 'command arg1 arg2');
OR without using the shell
$output = open3(my $out, my $in, 'command', 'arg1', 'arg2');
5.a2p
syntax: a2p [options] [awkscript]
There is a Perl utility known as a2p
which translates awk
command to Perl. It takes awk script as input and generates a comparable Perl script as the output. Suppose, you want to execute the following awk
statement
awk '{$1 = ""; $2 = ""; print}' f1.txt
This statement gives error sometimes even after escaping the variables (\$1, \$2) but by using a2p
it can be easily converted to Perl script:
For further information, you can read it’s documentation: a2p
More help at https://bioinformaticsonline.com/snippets/view/42920/perl-script-to-run-awk-inside-perl
6. system()
syntax: system( "command" );
It is also a Perl function (perlfunc) that executes a command and waits for it to get finished first and then resume the Perl script. The return value is the exit status of the command. It can be called in two ways:
system( "command arg1 arg2" );
OR
system( "command", "arg1", "arg2" );
HELP
Here are some useful Perl cheat sheets that can be used as a quick reference guide.-- https://www.pcwdld.com/perl-cheat-sheet