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

Re: Other form of greediness in Perl

by ikegami (Patriarch)
on Oct 01, 2007 at 16:55 UTC ( [id://641952]=note: print w/replies, xml ) Need Help??


in reply to Other form of greediness in Perl

Parameters passing and return values are greedy.

It has nothing to do with parameter passing or values being returned. It's assigning a list to an array that's "greedy". It doesn't matter if the RHS of the assignment is @_ or a function call.

my (@array, $scalar) = (1, 2, 3); print(scalar(@array), "\n"); # 3 print(defined($scalar)?1:0), "\n"); # 0

Replies are listed 'Best First'.
Re^2: Other form of greediness in Perl
by naikonta (Curate) on Oct 01, 2007 at 17:38 UTC
    It's supposed to be related with the opening,
    There are some functions, constructs, or areas where 'greediness' in fact exists...
    So, yes, it's not about the passing and returning. Rather, the greediness could happen in both events. I did mention about the array assignment that is greedy. Thanks, ikegami, I will update the sentence.

    Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found