Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Conditinal array initialisation?

by hdb (Monsignor)
on Jul 12, 2013 at 17:18 UTC ( #1044034=note: print w/replies, xml ) Need Help??

in reply to Conditional array initialisation?

From defined:

Use of defined on aggregates (hashes and arrays) is deprecated. It used to report whether memory for that aggregate had ever been allocated. This behavior may disappear in future versions of Perl.

Replies are listed 'Best First'.
Re^2: Conditional array initialisation?
by BrowserUk (Pope) on Jul 12, 2013 at 19:23 UTC

    That it doesn't work is clear.

    But, the semantics seem very clear, and the implementation trivial (roughly, without the need for copying):

    undef @a; @a = @a ? @a : (1..3); say @a;; 1 2 3 @a = (4..6); @a = @a ? @a : (1..3); say @a;; 4 5 6

    So I wondered why it isn't implemented so?

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re^2: Conditinal array initialisation?
by CountZero (Bishop) on Jul 12, 2013 at 19:06 UTC
    The explanation is even more confusing than the question.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1044034]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2018-04-21 14:13 GMT
Find Nodes?
    Voting Booth?