Hello all
I'm trying to strip off offensive characters from filename with the below snippet written long back (not by me) and is not doing what exact I want.
use strict; use warnings; print cleanfilename('abcdefghijklmnopqrstuvwxyz.xml'); sub cleanfilename { my ($ans) = @_; $ans =~ y/\/\\[]{}()?*#$^&@*;''""``<>%|//d; $ans =~ y/[[:space:][:cntrl:]]//d; return $ans; }
Output
bdfghijkmoquvwxyz.xm
In reply to Strip filename by kalyanrajsista
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |