Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Arrays and Push

by bigj (Monk)
on Apr 03, 2014 at 05:09 UTC ( [id://1080891]=note: print w/replies, xml ) Need Help??


in reply to Arrays and Push

Instead of push @{main::hd}, [@main::a]; you either wanted to write push @{main::hd}, $main::a; or push @{main::hd}, [@$main::a]; If you had used use strict; use warnings Perl would have told you that @main::a is an undefined value. Only the scalar (reference to an array) $main::a is defined by you (in line 2).

Greetings,
Janek

Replies are listed 'Best First'.
Re^2: Arrays and Push
by boftx (Deacon) on Apr 03, 2014 at 05:35 UTC

    I suspect that he did in fact have use strict; in place and is seeing such an error message. I say this because there is little or no reason to ever use fully qualified variable names unless one does not fully understand how to use my $variable (or our $variable) when use strict; is in effect.

    On a side-note, it is a pleasant surprise to see someone who knows about the "main" namespace. :)

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

Log In?
Username:
Password:

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

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

    No recent polls found