Rich Morin writes:
> Let's say that I want to use a command (e.g., md5) on a file.  No
> problem; just use:
> 
>    system("md5 $file");
> 
> Except that the file name could contain all manner of white space
> characters, shell wildcard characters, etc.  Is there a module that
> deals with this sort of thing (e.g., wrapping each argument in the
> appropriate kinds of quoting)?

As another correspondent wrote, the correct solution is to use the
list form of system().  If you need backticks and have 5.8, do this:

  open F, "-|", "md5", $file or die;
  while (<F>) { ... }

The Perl Cookbook has code for safe backticks that works with 5.004
and friends.

Nat

Reply via email to