This is not what you want to use to capture the output from a command; for that you should use merely backticks or qx//, as described in `STRING` in perlop. #### #!usr/bin/perl use say; use strict; use warnings; my $dir_before = `ls -la`; chomp $dir_before; say $dir_before; # execute your linux command with backticks `blastn -query example.fa -db /home/tinyos/blast_db/refseq_rna.00 -out results.txt`; my $dir_after = `ls -la`; chomp $dir_after; say $dir_after; __END__ $ perl bio.pl total 20 drwxr-xr-x 2 tinyos tinyos 4096 Jun 28 00:30 . drwxr-xr-x 7 tinyos tinyos 4096 Jun 28 00:19 .. -rw-r--r-- 1 tinyos tinyos 279 Jun 28 00:30 bio.pl -rw-r--r-- 1 tinyos tinyos 0 Jun 28 00:21 bio.pl~ -rw-r--r-- 1 tinyos tinyos 459 Jun 28 00:04 example.fa -rw-r--r-- 1 tinyos tinyos 458 Jun 28 00:04 example.fa~ total 32 drwxr-xr-x 2 tinyos tinyos 4096 Jun 28 00:30 . drwxr-xr-x 7 tinyos tinyos 4096 Jun 28 00:19 .. -rw-r--r-- 1 tinyos tinyos 279 Jun 28 00:30 bio.pl -rw-r--r-- 1 tinyos tinyos 0 Jun 28 00:21 bio.pl~ -rw-r--r-- 1 tinyos tinyos 459 Jun 28 00:04 example.fa -rw-r--r-- 1 tinyos tinyos 458 Jun 28 00:04 example.fa~ -rw-r--r-- 1 tinyos tinyos 10739 Jun 28 00:30 results.txt