> I'm sorry for posting something off-topic, but I hope one of the Very > Clever People here can help me. I'm having trouble with Getopt::Declare.
Well, I'm not Very Clever, but I can probably help you with that. > I get: > > Can't use string ("-delete") as a HASH ref while "strict refs" in > use at foo line [the one with my %args on]. > > Now, my reading of the perldoc says that what I'm doing is just fine. The bit of the documentation you missed was: As a special case, if a parameter consists of a single component (either a single flag or a single parameter variable), then the value for the corresponding hash key is not a hash reference, but the actual value matched. So you want: my %args=( action => ($args->{'-d'} || $args->{'-delete'})?'delete':'add', md5 => ($args->{'-md5'})?1:0, url => $args->{'-d'} || $args->{'-delete'} || $args->{'<url>'} ); > There's an example in the docs which is doing almost exactly what I > am doing. Search for "$args->{'-v'}{'<value>'}" to find it. It works differently because it has two components. (Yes, I'm aware that that's a little subtle). Damian