the output of this is:#!/usr/bin/perl package Vehicle; sub new { my($class) = shift; my(%params) = @_; bless { "Engine" => $params{"Engine"}, "Doors" => $params{"Doors"} }, $class; } package Car; our @ISA = (Vehicle); sub new { my($class) = shift; my(%params) = @_; my($self) = Vehicle->new(@_); $self->{"Colour"} = $params{"Colour"}; return(bless($self, $class)); } package main; my $car = Car->new( "Engine" => "1800cc", "Doors" => "4", "Colour" => "blue"); print("I have an " . %{$car}->{'Engine'} . "\n"); print("I have " . %{$car}->{'Doors'} . "\n"); print("The color is " . %{$car}->{'Colour'} . "\n");
how can i change this code so that the output is this:I have an 1800cc I have 4 The color is blue
Obviously the inserted words (Engine, Doors and Colour) are within the hash on the left-hand-side. how do i get them to display as well as the ones on the right-hand-side, which already appear???I have an Engine 1800cc I have 4 Doors The color is Colour blue
Considered: rinceWind: "Dupe of 592857" Vote was Keep: 11, Edit: 0, Reap: 17
Unconsidered: davido: Sufficient keep votes and positive node reputation prevent reaping. Please don't reconsider.
In reply to Hash from package by Yoda_Oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |