Re: hash keys and readable code

2009-11-11 Thread Uri Guttman
> "PP" == Philip Potter writes: PP> 2009/11/11 Uri Guttman : >> you can also simplify the copy a little with a hash ref: >> >> my $readfsgs_flags = { map { $_ => $flags->{$_} } @flags_to_copy } ; PP> Is this really simpler than my version? PP> @readfsgs_fla...@flags_to_copy} =

Re: hash keys and readable code

2009-11-11 Thread Philip Potter
2009/11/11 Uri Guttman : >> "PP" == Philip Potter writes: > >  PP>     my %readfsgs_flags; >  PP>     my @flags_to_copy = qw(limit); # can scale up by adding more hash > keys here >  PP>     @readfsgs_fla...@flags_to_copy} = @{$flag...@flags_to_copy}; >  PP>     my @results = readfsgs($testfi

Re: hash keys and readable code

2009-11-11 Thread Uri Guttman
> "PP" == Philip Potter writes: PP> my %readfsgs_flags; PP> my @flags_to_copy = qw(limit); # can scale up by adding more hash keys here PP> @readfsgs_fla...@flags_to_copy} = @{$flag...@flags_to_copy}; PP> my @results = readfsgs($testfilename, \%readfsgs_flags); PP>

hash keys and readable code

2009-11-11 Thread Philip Potter
Hi all, I have a subroutine which uses a hashref to accept optional parameters: sub do_test { my ($testfilename, $flags) = @_; ## etc... } Here $flags is given an hashref containing optional arguments such as { thorough => 1, limit => 3, retries => 2}. One (but not all) of the flags is,