Re: handling perl string containing '@' and '$' with system function



wong_powah@xxxxxxxx wrote in news:638c7b6c-b259-4438-84c5-
3ec7fff60cef@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

If I had a perl string $newpw which is inputed by a user and it may
contain special characters such as '@' and '$' (e.g. "5a@Wf7$X"). How
to pass it to the system function properly?
This does not work:
system("/usr/local/bin/acthw -pw \"$newpw\"");

The simplest way would be to bypass the shell:

system '/usr/local/bin/acthw', '-pw', $newpw;

perldoc -f system


Sinan


--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(remove .invalid and reverse each component for email address)
clpmisc guidelines: <URL:http://www.augustmail.com/~tadmc/clpmisc.shtml>

.



Relevant Pages

  • Re: Directories into arrays, again.
    ... shell command to copy a file is a bad idea. ... in the above case opendir will return nothing if it ... perldoc -f opendir ...
    (perl.beginners)
  • Re: Run a process in the background
    ... > I need to kick of some processes in my script. ... I'm kinda new to Perl, but in my OS's shell, I'd do ... Shell is considerably different than Perl when it comes to this stuff... ... perldoc perlipc ...
    (perl.beginners)
  • Perldoc security issues
    ... perldoc via the shell, but before I release it I'd like to ask ... there are shell related security issues too. ... I have left colons so people can look up modules, and quote marks ...
    (comp.lang.perl.misc)
  • Re: Perldoc security issues
    ... > perldoc via the shell, but before I release it I'd like to ask ... there are shell related security issues too. ... > I have left colons so people can look up modules, and quote marks ...
    (comp.lang.perl.misc)
  • Re: "system" with [ ] in filename
    ... The OP is on Win32, and you can't bypass the shell on Win32. ... Turing machine emulator in your script, ...
    (comp.lang.perl.misc)