#!/opt/perl5/bin/perl -w use strict; my @instances; my $i = 1; my $selection = 0; opendir OPHOME, "/opt/lnpsite" or die "Can't open /opt/lnpsite: $!\n"; my @files = sort(readdir(OPHOME)); foreach(@files){ if (m/(op|nm)\d{2}$/) { push(@instances, $_); } } print "\nAvailable Instances"; print "\n===================\n"; foreach(@instances) { print " $i. ",$_,"\n"; $i++; } print "\nSelect an instance and press enter: "; $selection = ; chomp($selection); $selection = $selection - 1; my $conn = ". /opt/lnpsite/" . $instances[$selection] . "/scripts/setup_env"; print "$conn\n"; exec $conn $instances[$selection] or die "Cannot execute $conn: $!\n";