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

Re^2: Hash from package

by Yoda_Oz (Sexton)
on Jan 04, 2007 at 09:07 UTC ( [id://592910]=note: print w/replies, xml ) Need Help??


in reply to Re: Hash from package
in thread Hash from package

thanks for the post mate. however thats not quite what im after. that's cheating what you've suggested.
i want those words you added in to come from the hash, not from adding to the print statement.

ie.
%hash => (Engine, 1800cc, Doors, 4, Color, blue)
print %hash
output is:
Engine 1800cc
Doors 4
Color blue

do you see where im coming from?

Replies are listed 'Best First'.
Re^3: Hash from package
by reasonablekeith (Deacon) on Jan 04, 2007 at 09:40 UTC
    I wouldn't call it cheating. You've already hardcoded some text and the hash key. Sagacity's suggestion is perfectly reasonable.

    You're probably asking the wrong question. "How do I get key values from a hash?" is more likely what you're after.

    foreach my $key (keys %$car) { print "$key = $car->{$key}\n"; }
    ---
    my name's not Keith, and I'm not reasonable.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://592910]
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-04-26 08:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found