ab52
1
hi Guys
in perl i have the following
my @rooms = qw( blah blag blah ) ;
That list of items can be generated from a command output
$ssh command
how can i combine it so it dont have to manully need to add to that list
something like this
my @rooms = qw(`$ssh comand`);
thanks
Adam
birei
2
Hi ab52,
It's qx without quotes, like:
my @rooms = qx($ssh comand);
ab52
3
I tired that, but it now failed on another part of the code
# ARGV check
$roommatch = grep( $_ eq $ARGV[0], @rooms );
($roommatch > 0) and $allow = "1";
my $cmd = " $ssh zmmailbox -z -m $ARGV[0] mfg Calendar account $ARGV[1] rwidax";
if ($allow == 1) {
system $cmd;
}
else {
print "Please enter a proper room name:\n\n";
foreach my $room (@rooms){
print "$room\n";
}
exit();
}
my $cmd2 = " $ssh zmmailbox -z -m $ARGV[1] cm --view appointment -F# /$ARGV[0] $ARGV[0] /Calendar ";
system $cmd2
you will see that there is a bit a the top to check if the command line option it in the @rooms
when i run it is just ends up spitting out the command?
ab52
5
it fails on the arg check, at the tip, instead of checking that the room exisit it just checks it out the command, not the command output
birei
6
Show us the qx command and add the following instruction just before the grep:
print "@rooms";
ab52
7
i figure it out,
my @rooms = split(" ",$rooms);
works a charm
Thank for the help
Adam