I came up with a need to use regular expressions. In my case my goal was to get the just the filename from a full path.
Here is my hack;
#!/usr/bin/perl
$_ = $ARGV[0];
$_ =~ s|^.*/([^/]*)$|$1|; print $_;
Simply invoke the script via PD using
... | [/home/me/pd/filename.pl $1( | [shell] | [pack s] | ...
andy