Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Difference between this array assignment and push

by rinceWind (Monsignor)
on May 16, 2007 at 14:37 UTC ( #615788=note: print w/replies, xml ) Need Help??


in reply to Difference between this array assignment and push

I would go with the first approach as it's much clearer what you are doing.

In the second case, @pics may have some previous contents that you are adding to. The code is iterating matches in a while loop; there's no reason to see why this would ever be better than picking up all matches as a list and assigning or pushing them to the array.

--
wetware hacker
(Qualified NLP Practitioner and Hypnotherapist)

  • Comment on Re: Difference between this array assignment and push

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://615788]
help
Chatterbox?
[1nickt]: choroba I'm trying to make a cpanfile for pm-cb ... how to handle the MCE vs Thread::Queue question? Maybe with on 'build' => sub { if ($threaded_perl) { requires 'Thread::Queue' } else { requires 'MCE' } ?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2017-10-18 13:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (244 votes). Check out past polls.

    Notices?