Backticks can be used to run a command in perl that is native to the underlying operating system. For example, let's say a Perl script is running on a Linux server. The following script is an example of how backticks can be used to run native Linux commands in Perl. Running this Perl script will print FooBar to the console.
#!/usr/bin/perl `echo FooBar`;
The prior example was not very practical, as you could print FooBar to the console in native Perl. However, there are some scenarios where a native operating system command is either just a heck of a lot easier, or there is no Perl command to run the native operating system command. As an example, let's say you want to view a certificate in a Java keystore. This certainly would be best done using a native operating system command.
`keytool -list -v -keystore /path/to/example.jks -storepass secret`;
Sometimes, it makes sense to store the native operating system command you want to run as a Perl variable.
my $file = "cat /path/to/example.txt";
Then, you can run the command using backticks and pipe native operating system commands.
my $bar = `$foo | grep Hello`;