#!/usr/bin/perl require 5.004; use English; use strict; use Data::Dumper; use Tk; my %ARGS = ( l=>'-l', a=>'-a', s=>'-s'); my %ARGS2 = ( l=>'-l', a=>'-a', s=>'-s'); # Setup remote ssh connection... use Net::SSH::Perl; #use Net::SSH::W32Perl; # For windows my $host='remotehost'; my $ssh = Net::SSH::Perl->new($host) || die "Bad $host"; #my $ssh = Net::SSH::W32Perl->new($host) || die "Bad $host"; # For windows $ssh->login('remoteusr', 'remotepass') || die "Bad login"; # Create new window... my $top = MainWindow->new(-title=>'Options Test'); $top->minsize(470,225); my $f = $top->Frame()->pack; my $t = $top->Scrolled('Text')->pack; # Add checkbuttions in frame... for my $o (keys(%ARGS)) { $f->Checkbutton(-text=>$ARGS{$o}, -offvalue=>'', -onvalue=>$ARGS{$o}, -variable=>\$ARGS{$o}, -command=>\&hostls, )->pack(-side=>'left'); # Reset checkbutton variable (default is off)... $ARGS{$o}=''; } sub hostls { print STDERR Dumper(\%ARGS); my $args = join(' ', values(%ARGS)); # This fails #my $args = join(' ', values(%ARGS2)); # This works print STDERR "args=$args\n"; $t->delete('1.0', 'end'); my($stdout, $stderr, $exit) = $ssh->cmd("ls $args"); if($exit) { warn "Bad Command return\n$stderr"; return() }; $t->insert('end', $stdout); } MainLoop();