I would like to understand the addition of "$"
Not, "$" but "$!". The exclamation mark is not just for decoration. See perlvar.
In reply to Re^3: use of $sub by tobyink in thread use of $sub by JimLS