Syntactic Confectionery Delight PerlMonks

### Re: Context tutorial

 on Jun 15, 2011 at 14:23 UTC ( #909789=note: print w/replies, xml ) Need Help??

I'm using Ubuntu Linux and double-quotes work for me.

You're right jdporter, I have no idea what I did that made it seem like perl -e " ... " worked in that case.

nodereaper, can you strike this? I guess that is not to form here.

UPDATE: Aha. I found out what I did that worked. It wasn't exactly what was in the instructions and I don't know why it worked. I just learned about say and I've been using it everywhere.

$perl -E "@now = localtime(); for (@now) { say; }" 21 20 10 15 5 111 3 165 1 [download] Replies are listed 'Best First'. Re^2: Context tutorial by jdporter (Canon) on Jun 16, 2011 at 12:28 UTC That's because you don't know what you're talking about. You're right. Don't know what I did before. deleting... $ perl -e "$now = localtime(); print$now;"
syntax error at -e line 1, near "="
Execution of -e aborted due to compilation errors.
[download]

As explained to me by ikegami and runrig in the chatterbox: perl -e "$now = localtime(); print$now;" and perl -e ' = localtime(); print ;' are equivalent in bash (Ubuntu's default) unless $now is an Environmental variable within the Bash shell. In other words if one is doing some Bash scripting and has defined$1 as a variable within that shell-script ... then the way to access that same system (environmental) $1 is to use perl -e " ...$1 ... ".

Cheers.

bash does support double quotes, but «\», «"» and «$» (and maybe more) are special in double quotes. $ perl -E'my $x = qq{abc\\def}; say$x'
abc\def

$perl -E"my \$x = qq{abc\\\\def}; say \\$x"
abc\def
[download]
On guard perl -le print~~localtime

Create A New User
Node Status?
node history
Node Type: note [id://909789]
help
Chatterbox?
 [tye]: Is it just me, or do most python things have terrible logging/errors? [LanX]: but but but ... the errors are nicely formatted! [tye]: 1) The python stack traces show you the names of variables, not the values of variables. Almost never informative. [LanX]: do you have a py job now? [tye]: Right now I have errors trying to fetch stuff from graphite. It says 'apps not ready, check startup logs'. I eventually find the startup logs and see 'no apps found'. Looking for fixes to this problem... [LanX]: no idea ... ask py monks! ;-p [tye]: it turns out that this can be caused by almost anything going wrong. If you want to know what caused the problem, you have to try to load each app by-hand to see what problems it is having, because none of those will be logged. [tye]: No, I write more Perl than py at work. But I have to deal with plenty of py things. [tye]: py monks would just be offended.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2017-09-21 20:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
During the recent solar eclipse, I:

Results (252 votes). Check out past polls.

Notices?