in reply to Re^3: problem with string literal in system()
in thread problem with string literal in system()

You forgot to take into account that $cmd contains double quotes. Why didn't you try it?
use strict; use warnings; my $cmd = '/opt/sudo/sudo /usr/bin/su - $ENV{LOGNAME} -c "$someScript" +'; $cmd = eval "\"$cmd\""; print($cmd, "\n");

outputs

Scalar found where operator expected at (eval 1) line 1, near ""/opt/s +udo/sudo /usr/bin/su - $ENV{LOGNAME} -c "$someScript" (Missing operator before $someScript?) String found where operator expected at (eval 1) line 1, near "$someSc +ript""" (Missing operator before ""?) Use of uninitialized value in print at 574310.pl line 5.

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.