use String::ShellQuote 'shell_quote'; my $cmd = shell_quote( 'echo', 'This is sample text ending in a slash ' ); `$cmd`;