in reply to Regular expression problemette

Basically the code provides the same functionality as the unix command basename. The code detects whether the invocation contained any path elements (eg $ ./code.pl or $ /home/user/code.pl) and returns the actual filename.

$this_proc = $0 # Filename of code (as invoked) =~ # "Perform" Regular Expression /^.+\/ # Matches everything until the last / (.+)$/ # Capture filename (in $1) ? # If Regex was successful $1 # Return the filename : # Otherwise (Else) $0; # Return the filename as invoked