#!/usr/bin/perl use strict; use warnings; use Net::OpenSSH; my $host = $ARGV[0]; my $ssh2 = Net::OpenSSH->new($host,user=>'root',timeout=>600); my @usernames = $ssh2->capture("du -s /var/lib/mysql/* |sort -nrk1 |awk -F'[\t_/]' '{if(\$1 > 100000) print \$(NF-1)}' |sort -u |grep -v 'mysql'"); foreach my $tempo (@usernames) { my @domains = $ssh2->capture("grep $tempo /etc/userdomains|cut -d: -f1"); #THIS IS NOT WORKING SINCE $TEMPO IS NOT DEFINED IN SHELL foreach (@domains) { print "TEST $_"; } }