Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Class array, push a new element

by Anonymous Monk
on Sep 07, 2014 at 22:53 UTC ( [id://1099830]=note: print w/replies, xml ) Need Help??


in reply to Re: Class array, push a new element
in thread Class array, push a new element

I think you've got a bug there; are you sure that the object contains the tasks after your push?

I think the line @{ $self->{_tasks} } = @taskArray; takes care of that?

Anyway, your version is indeed the shorter & more efficient one.

hatz, you may want to look at perlreftut and perlref.

Replies are listed 'Best First'.
Re^3: Class array, push a new element
by kennethk (Abbot) on Sep 07, 2014 at 23:07 UTC
    My eyes are broken. I should definitely not be working on a Sunday....

    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Thank you for your answers!

      Indeed the syntax you wrote looks better :

      push @{$self->{_tasks}}, $task;

      It does not raise the warning anymore ("push on reference is experimental at Project.pm line 40").

      I will get more familiar with references and how to get an array, hash or string out of one.

      Thank you again!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1099830]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found