RE: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- From: kzembowe@xxxxxxxxxx ("Zembower, Kevin")
- Date: Fri, 31 Oct 2008 13:44:15 -0400
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
.
- References:
- Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- From: Kevin Zembower
- Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- From: Paul Johnson
- Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Prev by Date: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Next by Date: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Previous by thread: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Next by thread: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Index(es):
Relevant Pages
|