Where are perl constants replaced by their values?
问题 I tried to use constant values in perl and stumbled upon the following weird behaviour: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use constant { a => "b" }; my $c = { a => a }; my %d; $d{a} = a; print Dumper($c); print Dumper(\%d); will output $VAR1 = { 'a' => 'b' }; $VAR1 = { 'a' => 'b' }; The constant a was replaced on the right hand side of the expressions $d{a} = a and a => a , but not on the left side. I know that constants are implemented using inlinable subs