in reply to GetOptions problem

bory,
As indicated previously, this problem might benefit from a configuration file. If you go this route, I would suggest still using a Getopts:: module to specify the location of the configuration file so you could have multiple versions prepared in advance. I personally like using Config::IniFiles. If you want to avoid an external configuration file, the following seems to meet your needs though I didn't spend a great deal of time testing it:
#!/usr/bin/perl use strict; use warnings; use Getopt::Std; my %opt; Get_Args( \%opt ); for ( sort { $a <=> $b } keys %opt ) { if ( uc $opt{$_} eq 'F' ) { print "Channel $_ is set to Forever\n"; } elsif ( $opt{$_} =~ /^(\d\d?):(\d\d?)/ ) { my ($hr, $min) = ($1, $2); print "Channel $_ is set to $hr hour(s) and $min minute(s)\n"; } else { die "$opt{$_} is not a valid option for channel $_\n"; } } sub Get_Args { my $opt = shift; my $Usage = qq{Usage: $0 [options] -# <F|HH:MM> -h : This help message. -# : Channel Number followed by duration F = forever HH:MM = Hours and Minutes } . "\n"; my $channels = join ':', 1..10; # Adjust for the max # of channel +s getopts( "h$channels:" , $opt ) or die $Usage; die $Usage if $opt->{h} || ! keys %$opt; }

Cheers - L~R