Maybe something along those lines:
use strict; my $filename = 'fielname.doc'; $filename = &trim($filename); unless( $filename =~ /\s/ ) { ## commit print 'Commit', "\n"; } ## Removes leading and trailing spaces sub trim() { my $nm = shift; $nm =~ s/^\s+//; $nm =~ s/\s+$//; return $nm; }
In reply to Re: perl script to disallow spaces in file or dir name
by diddy_perl
in thread perl script to disallow spaces in file or dir name
by siddhu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |