in reply to Re: Re: Hash sorting
in thread Hash sorting

1. The chomp comes before the split so that you remove carriage-returns from each line before you split it into $key and $value. If you don't do this, each $value will retain a trailing carriage return. Chomping the line after the split is pointless in this case, since you don't use the implicit variable $_ again.

2. $calhash{$key} is the value in %calhash which the key $key points to. I'm assigning it a new value $value. Later, if I want the key and value again (like in the printing loop), I'll refer to $key and $calhash{$key}.

The syntax for Variable Names is covered in perldata of the perl documentation.

buckaduck