RE: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"



Oh, it was that simple. Thanks so much, Paul. -Kevin

-----Original Message-----
From: Paul Johnson [mailto:paul@xxxxxxxx]
Sent: Friday, October 31, 2008 1:42 PM
To: Zembower, Kevin
Cc: 'beginners@xxxxxxxx'
Subject: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"

On Fri, Oct 31, 2008 at 01:34:05PM -0400, Zembower, Kevin wrote:
(This should probably be an easy one for someone.}

Why doesn't this work:
kevinz@centernet:/usr/local/src/rrd$ perl -e "@s=(["a","b"],["c","d"]);print $s[0][0];"
syntax error at -e line 1, near "]["
Execution of -e aborted due to compilation errors.
kevinz@centernet:/usr/local/src/rrd$ perl -e "@s=([1,2],[3,4]); print $s[0][0];"
syntax error at -e line 1, near "]["
Execution of -e aborted due to compilation errors.
kevinz@centernet:/usr/local/src/rrd$

I'm expecting either an 'a' or a '1'.

This is almost a character-by-character copy of the top example on page 269
of the Camel book. What am I overlooking?

Tryx using single quotes around the commandline script.

--
Paul Johnson - paul@xxxxxxxx
http://www.pjcj.net
.



Relevant Pages