1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6
7 sub fillerup ($);
8
9 my %fillme = (gas_pr => 3.59, gas_capacity => 14);
10
11
12 local $\ = "\n";
13
14 print '-'x80;
15 foreach my $key (keys %fillme ) {
16 print $key . '=' . $fillme{$key};
17 }
18
19 fillerup ( \%fillme );
20
21 print '-'x80;
22
23 foreach my $key (keys %fillme ) {
24 print $key . '=' . $fillme{$key};
25 }
26
27 sub fillerup ($) {
28 no strict;
29 local *hashref = shift;
30 # my $hashref = shift;
31
32 print "Prior to inserting a record in fillerup...";
33 print '*'x80;
34
35 foreach my $key (keys %$hashref ) {
36 print $key . '=' . $hashref->{$key};
37 }
38
39 $hashref->{filled_up} = 12.3;
40
41 print '*'x80;
42
43 foreach my $key (keys %$hashref ) {
44 print $key . '=' . $hashref->{$key};
45 }
46
47 print '*'x80;
48
49 return;
50 }
####
-------------------------------------------------------------
gas_capacity=14
gas_pr=3.59
Prior to inserting a record in fillerup...
******************************************************************************
******************************************************************************
filled_up=12.3
******************************************************************************
-------------------------------------------------------------
gas_capacity=14
gas_pr=3.59
####
-------------------------------------------------------------
gas_capacity=14
gas_pr=3.59
Prior to inserting a record in fillerup...
******************************************************************************
gas_capacity=14
gas_pr=3.59
******************************************************************************
gas_capacity=14
filled_up=12.3
gas_pr=3.59
******************************************************************************
-------------------------------------------------------------
gas_capacity=14
filled_up=12.3
gas_pr=3.59