I have been trying to learn Perl...i was doing well then i tried to take a new step and things quit working. Now i have this code that i have been attempting to run on ideone.com. I know the problem starts on line 40ish (the first print statement)but i have not been able to figure out why the process crashes... It's a simple thing and looks very square because i am coming from a long C++ background. Any help that can get me off of this hump would be sooooo much appreciated.

package Employee; sub spawn { my $invocant = shift; my $class = ref($invocant) || $invocant; + my $self = { empid => 200, name => "Joe", pay => 20, @_, }; sub get_name { my $self = shift; return $self-> (name); } sub set_name { my $self = shift; $self -> (name) = shift; } sub get_pay { my $self = shift; return $self-> (pay); } sub set_pay { my $self = shift; $self -> (pay) = shift; } return bless $self, $class; } $wk1 = Employee->spawn(name=>"Joe", empid=>201, pay=>25); $wk2 = Employee->spawn(name=>"Moe"); $wk3 = Employee->spawn(name=>"Bob", empid=>202); print $wk1->name," Earns ",$wk1->pay," dollars per hour. His/her Emp I +D is: ",$wk1->empid; print $wk2->name," Earns ",$wk2->pay," dollars per hour. His/her Emp I +D is: ",$wk2->empid; print $wk3->name," Earns ",$wk3->pay," dollars per hour. His/her Emp I +D is: ",$wk3->empid; print "Got this far!"; $wk1->set_pay(70); $wk2->set_name("NewMoe"); print $wk1;#->name," Earns ",$wk1->pay," dollars per hour. His/her Emp + ID is: ",$wk1->empid; print $wk2;#->name," Earns ",$wk2->pay," dollars per hour. His/her Emp + ID is: ",$wk2->empid; print $wk3;#->name," Earns ",$wk3->pay," dollars per hour. His/her Emp + ID is: ",$wk3->empid;

In reply to "Can't locate object method" error by doctor T

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.