in reply to trouble understanding code, and shift() w.o args

Inside the main body of code, shift without an argument defaults to using @ARGV (the command-line arguments to the script). Inside of a subroutine, shift without an argument defaults to using @_ (the arguments passed to the subroutine).

%nu_hash is counting the occurrences of substrings in the string passed into the subroutine. You can see that code in the following lines:

$sstr=substr($str,$idx,$pl); $nu_hash{$sstr}++;