# perhaps you want this my $cmd1 = 'This'; my $cmd2 = 'Is'; my $cmd3 = 'a'; my $cmd4 = 'test'; push @cmds, ( $cmd1, $cmd2, $cmd3, $cmd4 ); print "$_\n" for @cmds; # or perhaps you want this @cmds = qw( This is a test ); print "$_\n" for @cmds; # or perhaps if you want commands that do something and can only be x +y z my %command = ( this => sub { print "Doing this!\n" }, that => sub { print "Doint that!\n" }, other=> sub { print "Doin' t' other brother!\n" }, exit => sub { print "Goodbye!\n"; exit }, ); my $cmd_list = join ', ', keys %command; while (1) { print "Command ($cmd_list): "; chomp (my $do_it = <> ); if ( $command{$do_it} ) { &{$command{$do_it}}; } else { print "Don't know how to $do_it!\n"; } } __DATA__ C:\>perl test.pl Command (other, this, that, exit): help Don't know how to help! Command (other, this, that, exit): other Doin' t' other brother! Command (other, this, that, exit): exit Goodbye! C:\>
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Specifiying a Range for Variables?
by tachyon
in thread Specifiying a Range for Variables?
by dru145
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |