Erm, %{$hashref}->{'key'} has some extra line noise in it. You'd really want either $car->{'key'}, or alternately ${ $car }{ 'key' }. You don't use the hash sigil when accessing a single element, just like you don't use @array[$idx] to access a single element from an array.</nit>
| [reply] [d/l] [select] |
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? | [reply] |
foreach my $key (keys %$car) {
print "$key = $car->{$key}\n";
}
---
my name's not Keith, and I'm not reasonable.
| [reply] [d/l] |