Here you go. My Paypal for the twenty. Please note that a public offer of a reward is legally binding.
package Employee; use strict; use warnings; sub new{ my ($class, $args) = @_; my $self = bless { name=> $args->{name}, hourlywage => $args->{hourlywage}, hours => $args->{hours} }, $class; } sub pay { my $self = shift; return $self->{hours} * $self->{hourlywage}; } sub gist { my $self = shift; return "Employee info: name: $self->{name} hours: $self->{hours} w +age: $self->{hourlywage}\n" } 1; package EmployeeList; use diagnostics; use strict; use warnings; sub new{ my ($class) = @_; my $self = bless { EmployeeList => [] }, $class; return $self; } sub add_Employee { my $self = shift; my $Employee = shift; push @{ $self->{EmployeeList} }, $Employee; } sub gist{ my $self = shift; my @gist = map { $_->gist } @{ $self->{EmployeeList} }; return join "", @gist; } sub average_hourly_wage{#not even sure where to begin, don't know how +to initialize or access the hash at this point my $self = shift; my $wages; my $count; foreach my $employee ( @{ $self->{EmployeeList} }) { $wages += $employee->{hourlywage}; $count++; } return $wages / $count; } sub find { my $self = shift; my $name = shift; foreach my $Employee ( @{ $self->{EmployeeList} } ) { return $Employee if $Employee->{name} eq $name; } } 1; #use Employee; #use EmployeeList; print "Enter the name of the file to open: "; my $input_file = <STDIN>; chomp $input_file; open(my $file_handle, "<", $input_file) or die "failed to open < input +_file: $!\n"; my $EmployeeList = new EmployeeList(); while (my $row = <$file_handle>){ my @splitrow = split ' ', $row; my $Employee1 = Employee->new({ name =>$splitrow[0], hourlywage =>$splitrow[1], hours =>$splitrow[2] }); $EmployeeList->add_Employee( $Employee1 ); } print $EmployeeList->gist(); print $EmployeeList->average_hourly_wage(), "\n"; print $EmployeeList->find("holli")->pay, "\n";


holli

You can lead your users to water, but alas, you cannot drown them.

In reply to Re: Newbie question under time constraint by holli
in thread Newbie question under time constraint by crazedrat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.