%libs = get_libs($path); #### ldd #### linux-vdso.so.1 (0x00007ffff733a000) libems_sh.so => not found libdl.so.2 => /lib64/libdl.so.2 (0x00007ffff7b337000) libtq.so => not found #### my $cmd = "ldd $path"; my ($stdout, $stderr, $exit_status) = capture { system($cmd); }; next if (exit_status); foreach my $line (split(/\n/, $stdout)) { if ($line =~ /(.*)\s*=>\s*(.*)/) { my $lib_path = $2; if ($lib_path =~ /(.*)\s+(.*)/) { $lib_path = $1; $paths{$lib_path}++; print("Found $lib_path of $path\n"); } else { print("Invalid line: $line of $path\n"); } } else { print("Invalid line: $line of $path\n"); } }