Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: using hash key as hash value ...

by blackjudas (Pilgrim)
on Oct 02, 2001 at 04:39 UTC ( [id://116034]=note: print w/replies, xml ) Need Help??


in reply to using hash key as hash value ...

The hash %media hasn't been scoped yet, the interpreter executes the 'line' at the semicolon. Therefore %media doesn't exist until perl sees the semicolon. In your case, I would suggest breaking out the assignments into different instructions. Such as the following:

my %media = ( bond => "USLetter:Plain:white:75" ); $media{'letter'} = $media{'bond'}; $media{'plain'} = $media{'bond'};

Though there's probably better ways to do it through looping etc, it all depends on what you need done.

Replies are listed 'Best First'.
Re: Re: using hash key as hash value ...
by blueflashlight (Pilgrim) on Oct 02, 2001 at 07:11 UTC
    I'll probably do it the way you suggest. It seems like it's "easiest" on the eyes.

    thanks, --sandy

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2024-03-29 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found