[vox-tech] quoting question in perl

Ted Deppner vox-tech@lists.lugod.org
Thu, 20 Dec 2001 18:05:16 -0800


On Thu, Dec 20, 2001 at 05:06:29PM -0800, Peter Jay Salzman wrote:
> system("rm $filename");
> 
> and $filename = "a file", you get an error because you're trying to delete
> two files, "a" and "file".
> 
> what's the proper way of quoting $filename so that the shell sees the file
> "a file" and not the two non-existant files "a" and "file"?

perlfunc -f system indicates
  system("rm",$filename);

would work.  Switch from single entry, to array, and the quoting seems
taken care of.

You could also use 
  system("rm '$filename'")

-- 
Ted Deppner
http://www.psyber.com/~ted/