I want to take date as input from User & pass that input to shell command below.
for e.g.
$date = ARGV[0];
`cd xyz $date`
will this variable be interpolated in perl?
You have a couple of problems; first of all, cd
only takes one parameter. Perhaps you meant something like cd xyz$date
? Second, backticks start a shell that executes the command you give, which will do the change directory command and then immediately exit, having no effect. (The parent perl process's current directory is left unchanged.) You might be looking for chdir
.
But yes, the interpolation will work; to disable interpolation in backticks, you either escape special characters (echo xyz \$date
) or use qx with single quote delimiters (qx'echo xyz $date'
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With