From: Ashutosh Jog [mailto:[EMAIL PROTECTED]]
> 
> Hi,

Hello,

> Another question:
> 
> If I have a hash with entries like these:
> 
> my %hash = ($animals [0]=> [$mammals[0]], $animals[1] => [$mammals[1]]);
> 
> But if the list has like 50 entries in both the $animals & $mammals the can
> I do
> this?
> 
> my %hash = ($animals [0..49]=> [$mammals[0..49]]);
> 
> What I want to avoid is the number of time I have to type in the %hash
> entries.
> It did not seem to work well.


When you want an array slice or a hash slice you have to use @ instead
of $ in front of the name.

my %hash;
@hash{ @animals[0..49] } = @mammals[0..49];


perldoc perldata



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to