in reply to quite weird regexp

So let's see what this does:

$z= $0; # store the name of the script in $z $z=~ s{.* # anything, greedy match / # then a / (the last one in $z as the match is greedy) }{}x; # removed

So this snippet just returns the basename of the script.

And as you see you can also use brackets like { } as delimiters, and the x modifier lets you comment the regexp.