in reply to Re^9: hex code passed from command line is interpreted literally in substitution
in thread hex code passed from command line is interpreted literally in substitution

I'm sorry, I retract that.

Would you agree then with AM, that it would be possible for eval to execute a system command if the appropriate code were typed in and used as one of the variables in the string below:
eval "s/$arg_1/$arg_2/";
  • Comment on Re^10: hex code passed from command line is interpreted literally in substitution
  • Download Code

Replies are listed 'Best First'.
Re^11: hex code passed from command line is interpreted literally in substitution
by ikegami (Patriarch) on Mar 10, 2011 at 23:35 UTC

    Most definitely:

    $arg1 = '//; system( ... ); #';

    Or without even breaking out of the s///:

    $arg1 = '${ system( ... ) }';
      ooooooh....

      btw, what does the # do?
        Say
        $arg1 = '//; system( ... ); #'; $arg2 = '1234;

        then

        eval "s/$arg_1/$arg_2/";

        becomes

        eval 's///; system( ... ); #/1234/';

        The # causes the last bit to be a comment. Not necessary, apparently.