Re: VMS shell quoting help

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.lang.perl.ports.vms
Message-ID <[email protected]>
On Apr 10, 2009, at 2:33 PM, Michael G Schwern wrote:

> In debugging a new and fascinating MakeMaker/VMS problem, I  
> discovered this gem:
>
> $ perl -wle "print q[12 '3' 45]"
> 12 '3' 45
> $ perl -wle "print q[12 '' 45]"
> 12
>
> '' seems to mean something special, even inside double quotes!
>
> What's going on and what's the work around?

Single quotes cause symbol expansion.  Inside double quotes, that  
normally doesn't happen, but you can force it to by doubling the first  
single quote:

$ foo = "Bar"
$ write sys$output "''foo'"
Bar

And as you discovered, a doubled single quote inside double quotes  
evaluates to nothing if the next token is not a symbol.

The only thing I can think of at the moment if you really need the  
literal single quote is pasting together separate strings:

$ perl -wle "print q[12 '] . q[' 45]"
12 '' 45

>
>
> For the curious, the issue is this:
>
> 	$(NOECHO) $(ABSPERLRUN) "-MExtUtils::Install" -e "pm_to_blib({@ARGV},
> '[.blib.lib.auto]', '$(PM_FILTER)', '$(PERM_DIR)')" "--" -

In this case maybe

'[.blib.lib.auto]', '$(PM_FILTER)', '$(PERM_DIR)'

could become

q{[.blib.lib.auto]}, q{$(PM_FILTER)}, q{$(PERM_DIR)}


>
>
> when PM_FILTER is not set.  The argument is completely lost and perl  
> sees:
>
>    pm_to_blib({@ARGV}, '[.blib.lib.auto]', , '755')
>
> to add to the fun, Perl will collapse multiple commas.  So that's  
> equivalent to:
>
>    pm_to_blib({@ARGV}, '[.blib.lib.auto]', '755')
>
> and the PM_FILTER argument is lost to the void. :/
>
>
> -- 
> Defender of Lexical Encapsulation

________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
  difficult than getting in."
                  Brad Leithauser
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.