in reply to Re^4: Comparing 2 different-sized strings
in thread Comparing 2 different-sized strings
but where do you actually declare them as references, using the slash operator?
You don't "declare" references -- they are just scalars with 'special content' -- you 'take references' when you need them.
In the case of the code, the references are taken when the subroutine is called:
... for fuzzyMatch( \$hay, \$nee, 3 ); #....................^......^
Ie. $hay & $nee are normal strings in the main program.
When I call fuzzyMatch( \ $hay, \ $nee, 3 ), I am taking references to those two strings (using '\') and passing them into the subroutine.
In the subroutine those references get assigned to the local variables: $rHay & $rNee respectively:
sub fuzzyMatch { my( $rHay, $rNee, $misses ) = @_; ...
|
|---|