use warnings; use strict; use Data::Dumper; package Blah; sub new { my ($class, $browser) = @_; return bless {browser => $browser}, $class; } package main; # the example you're interested in is below my %screenshots; for my $browser ('ie', 'ff', 'chrome'){ $screenshots{$browser} = Blah->new($browser); } print Dumper \%screenshots; #### $VAR1 = { 'ie' => bless( { 'browser' => 'ie' }, 'Blah' ), 'ff' => bless( { 'browser' => 'ff' }, 'Blah' ), 'chrome' => bless( { 'browser' => 'chrome' }, 'Blah' ) };