#!C:/Perl64/bin/perl.exe use strict; use warnings; use Control::CLI; my $cli; my $output; my $temp; my $junk; my $port; my $result; my @STATION_LIST_6 = qw/A B C D E F/; my @STATION_LIST_4 = qw/A B C D/; ... my $STATION_CNT = 4; my $FREEMEM; print "Configuring blah blah blah...\n"; print "\tChecking free memory on appropriate blades to ensure there is enough for application execution...\n"; foreach my $stid (@STATION_LIST_$STATION_CNT) { <-- This line doesn't work... $junk = $cli->print("echo STATION_\$stid; su -c \"ssh STATION_\$stid free -g\""); $output = $cli->cmd("password"); $FREEMEM = $output =~ m/^.*?\w+:\s+\d+\s+\d+\s+(\d+)\s.*$/s if ( $FREEMEM >= 4 ) { print "\t\tSTATION_$stid reports sufficient free memory...\n"; } else { print "\t\tSTATION_$stid reports insufficient free memory ($FREEMEM)... Please investigate and start application again... Exiting program.\n"; exit; } }