John Krahn wrote:
> The way I've seen that done sometimes is like this:
>
> sub frobitz {
> my %opt = (
> name => 'blueberry',
> color => 'blue',
> texture => 'medium',
> price = 30,
> @_
> );
>
> # ... do something useful
> }
>
> T
Lawrence Statton wrote:
I was *JUST* lecturing my student on hash-slices Monday ...
Part of that lecture
Passing named paramters, implemented as a hash, is a popular style.
Look at all of Perl/Tk, for example. For systems where you might pass
dozens of parameters to a method (or subroutine),
> Dear Sean,
>
> Hash Slice (only reminded of this the other day). Example code:
>
> use strict;
> use warnings;
>
> my @first = 'A' .. 'Z';
> my @second = 'a' .. 'z';
>
> my %hash;
> @[EMAIL PROTECTED] = @second;
>
> use Data::Dumper;
> print Dumper(\%hash);
>
> __END__
>
> Not a particul
Dear Sean,
Hash Slice (only reminded of this the other day). Example code:
use strict;
use warnings;
my @first = 'A' .. 'Z';
my @second = 'a' .. 'z';
my %hash;
@[EMAIL PROTECTED] = @second;
use Data::Dumper;
print Dumper(\%hash);
__END__
Not a particularly "beginner" way to do it though.
I have two arrays of equal length and I would like to make a hash using
one array as the keys and one as the values. Is there a simpler way of
doing this besides making a loop and counter variable?
Thanks,
Sean
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL