in reply to
trouble understanding code, and shift() w.o args
Why are those variables (%nu_hash and $sstr) empty? It is good programming practice to initialize variables. That way, you know for sure what value they contain. Both are used shortly after, but you noticed that. Since they are declared within the subroutine, they will disappear after the subroutine returns control to the main program. Your example is a short subroutine, but this is just good practice to get into.
When this subroutine is used, it probably looks something like this:
$returned_value = getXCharacterPatterns($var1, $var2);
Let's say $var1 = 1, $var2 = 2. When the subroutine runs, Perl will create the array @_ = [1,2]. The first shift will take the first element off the array, and return it. $str will now equal 1, and @_ = . The second shift works similarly. $pl = 2 and @_ will now be empty.