develooper Front page | perl.beginners | Postings from February 2002

Re: file names with spaces in perl

Thread Previous
Jenda Krynicky
February 27, 2002 08:32
Re: file names with spaces in perl
Message ID:
From:           	"Johnson, Shaunn" <>
> I'm having a problem with trying to get
> a list of files with spaces in them.
> I'm writing a perl script that goes into
> a directory, get a list of files with spaces
> in them (this is a file.doc) and run a
> mkisofs command against it.
> I can get a list of the files:
> [example]
> $debug=2;
> foreach $cmd (`ls -1 $report_dir`)
> [/example]
> This *looks* like it gives me what i want (a list
> of directories that have spaces in them, but
> when i try something like this:

Please don't shell out (start external processes) unless you have to.
Use readdir or glob instead!

> [example]
>  {
>         $mkisofs -f -J -r -hide-joliet-trans-tbl -V 'Report' -T -v -o
> '$iso_dir/$cmd.iso' "$report_dir";
>         }
> __END__
> [/example]

print the command instead of executing it, Maybe you'll notice 
what the problem is. Also ... I don't see any system(), backticks or 
whatever in your code, didn't you copy&pasted the real code into 
your post?


=========== == ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
					--- me

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About