in reply to Re: Reading special characters from file?
in thread Reading special characters from file?

quotemeta() did the trick. The problem was occurring because I passed the files to the shell using:

$cmd = 'someshellexe ' . $basepath . '/' . $file; $rc = qx($cmd);

The $ was being interpreted when passed to the shell. Changing this to:

$cmd = 'someshellexe ' . $basepath . '/' . $file; $escapedcmd = quotemeta($cmd); $rc = qx($escapedcmd);
worked like a charm. Thanks to all for the help!

Replies are listed 'Best First'.
Re: Re: Re: Reading special characters from file?
by premchai21 (Curate) on Apr 26, 2001 at 19:13 UTC
    A hint: you can do that a bit more readably by using interpolation -- note that Perl won't doubly interpolate, even though the shell might once you pass the value to it:
    $cmd = "someshellexe $basepath/$file"; $cmd = quotemeta($cmd); $rc = qx($cmd); #
    ... unless, as I take it, $rc eq 'result code', in which case use $rc = system($cmd), unless the result code is actually in the output of the command, in which case use qx.