in reply to remove directory path

Try This
$file = "/opt/local/bin/zap.exe"; $file =~ s/.*\///g; print $file;