Re: Question on DeFoy's range operator example
by choroba (Cardinal) on Jan 27, 2019 at 22:47 UTC
|
Maybe you are on MSWin where quotes behave differently to *nix? The \$, is there to prevent the shell from expanding the $, (which wouldn't happen anyway), on MSWin, you are safe to remove the backslash (as we're on *nix).
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] [select] |
|
>perl -le "\$, = q( ); print q(a)..q(z)"
Experimental aliasing via reference not enabled at -e line 1.
>perl -le "$, = q( ); print q(a)..q(z)"
a b c d e f g h i j k l m n o p q r s t u v w x y z
>perl -le '$, = q( ); print q(a)..q(z)'
Can't find string terminator "'" anywhere before EOF at -e line 1.
>perl -le '\$, = q( ); print q(a)..q(z)'
Can't find string terminator "'" anywhere before EOF at -e line 1.
| [reply] [d/l] |
|
| [reply] |
Re: Question on DeFoy's range operator example
by 1nickt (Canon) on Jan 28, 2019 at 12:32 UTC
|
Presumably you mean brian d foy? Where did you come up with that spelling?
I have thought for 15 years or more that it's a silly affectation, but it's his name and his choice, and every book, every article on the blog you quoted, every conference announcement and, yes, post in this monastery, has carried that rendition for that long or more. It seems a bit disrespectful, or, at least, inattentive, to come up with your own version of it.
(FWIW the blog post you asked about shows commands with single and double quotes and with and without the backslash...)
Hope this helps!
The way forward always starts with a minimal test.
| [reply] [d/l] |
|
| [reply] |
|
My bad
I wouldn't be too worried about it.
Just because Brian can't spell his own name correctly is no reason that everyone else should perpetuate the error ;-)
Cheers, Rob
| [reply] |
|
|
Re: Question on DeFoy's range operator example
by bliako (Monsignor) on Jan 28, 2019 at 10:55 UTC
|
perl -le "$(cat <<'EOF'
$, = q( ); print q(a)..q(z);
print "I am a JAPH-BASH in-line-multi-line.\n";
EOF
)"
Heredoc, only in bash
bw, bliako | [reply] [d/l] |
Re: Question on DeFoy's range operator example
by Theodore (Friar) on Jan 28, 2019 at 09:17 UTC
|
Using a csh instead of bash maybe?
With bash, the original works fine. With tcsh, i'm getting the same error about aliasing, which goes away when i remove the backslash:
$ perl -le '$, = q( ); print q(a)..q(z)'
a b c d e f g h i j k l m n o p q r s t u v w x y z
| [reply] [d/l] |
|
which goes away when i remove the backslash:
... and, at the same time, replacing the double quotes with single. They go hand-in-hand 🙌 | [reply] |
|
No, bash 4.4.23 on a mac.
| [reply] |
Re: Question on DeFoy's range operator example
by nysus (Parson) on Jan 28, 2019 at 11:44 UTC
|
Ah, dammit. I was using single quotes and he has double quotes. My bad.
| [reply] |
|
| [reply] [d/l] |
|
It's not needed, but doesn't hurt. `$,` is not a valid variable name in bash, but if you don't remember the bash rules, you can safely quote every $.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] |