Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Can't use string "1" as a HASH ref while "strict refs" in use

by tradez (Pilgrim)
on Mar 04, 2002 at 19:22 UTC ( #149184=note: print w/ replies, xml ) Need Help??


in reply to Can't use string "1" as a HASH ref while "strict refs" in use

one of those is simply a scalar. to find out which add this code precursing that line

print "ref of switchnum = ref($switchnum) \n ref of calltype = ref($calltype) \n";
The one that is ne "HASH" is your culprate

Tradez
"Never underestimate the predicability of stupidity"
- Bullet Tooth Tony, Snatch (2001)


Comment on Re: Can't use string "1" as a HASH ref while "strict refs" in use
Download Code
Replies are listed 'Best First'.
Re: Re: Can't use string "1" as a HASH ref while "strict refs" in use
by Juerd (Abbot) on Mar 04, 2002 at 19:55 UTC
    Let's try:
    my $switchnum = 15; my $calltype = []; # Empty array ref print "ref of switchnum = ref($switchnum) \n ref of calltype = ref($calltype) \n";
    It prints:
    ref of switchnum = ref(15) ref of calltype = ref(ARRAY(0x1234567))


    Guess what: you can't interpolate functions that way :)

    Try this one:
    ref(eval "\$$_") or warn "\$$_ is not a reference" for qw(switchnum ca +lltype);

    ++ vs lbh qrpbqrq guvf hfvat n ge va Crey :)
    Nabgure bar vs lbh qvq fb jvgubhg ernqvat n znahny svefg.
    -- vs lbh hfrq OFQ pnrfne ;)
        - Whreq
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-30 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls