On 2019-12-01 12:12, yary wrote:
Hi Todd,
Going back to the original post-
print( "Drive $Drive" ~ ":" ~ '\' ~ " dismounted\n\n" );
Inside a single quote, the \' combination is how you make a single quote, eg
$ perl6
> 'Saying \'hello\' to you'
Saying 'hello' to you
ways around it-
print( "Drive $Drive:\\dismounted\n\n" ); # I prefer, no need for ~
or
print( "Drive $Drive:" ~ Q'\' ~ " dismounted\n\n" );
-y
Hi Yary,
The single and double quote thing in Windows drive me a
bit insane.
I do the `Str ~ weird char` thing as it is easier for me
to under stand that I am combining string unfriendly
parts. And I don't have to remember who escapes what.
I may have to give up the practice with Windows
I do not understand the Q'\'
Windows
K:\Windows\NtUtil>perl6 -e "my $Drive = \"B\";print( \"Drive $Drive:\" ~
Q'\' ~ \" dismounted\n\n\" );"
Drive B:\ dismounted
Linux
$ perl6 -e 'my $Drive = "B";print( "Drive $Drive:" ~ Q"\'" ~ "
dismounted\n\n\" );'
bash: syntax error near unexpected token `)'
Linux
$ perl6 -e 'my $Drive = "B"; print( "Drive $Drive\:\\ dismounted\n\n" );'
Drive B:\ dismounted
Windows
K:\Windows\NtUtil>perl6 -e 'my $Drive = "B"; print( "Drive $Drive\:\\
dismounted
\n\n" );'
===SORRY!=== Error while compiling -e
Unable to parse expression in single quotes; couldn't find final "'"
(correspond
ing starter was at line 1)
at -e:1
------> 'my<HERE><EOL>
expecting any of:
single quotes
statement list
term
Windows again escaping double quotes
K:\Windows\NtUtil>perl6 -e "my $Drive = \"B\"; print( \"Drive $Drive\:\\
dismounted\n\n\" );"
Drive B:\ dismounted
Thank you for the help!
-T
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~