use strict; use Data::Dumper; my @agents; open (FH,'matrix.csv'); while() { chomp; push @agents, VRTSAgent->new(split(/\s*,\s*/,$_,6)); } close FH; print Dumper $_ for @agents; package VRTSAgent; use strict; use Carp; use Data::Dumper; sub new { my $class = shift; my $self = _init(@_); return bless $self, $class; } sub _init { my %init = ( agent => undef, os => [shift,shift], version => [@_], ); return \%init; } # here is how i would code _dump_os # note: if the client is going to call a method # then don't prefix that method with an underscore! # only private methods should be prefixed with underscores sub dump_os { my $self = shift; print Dumper($self->{os}); } # you could call it like so: $_->dump_os for @agents;