Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- From: kzembowe@xxxxxxxxxx (Kevin Zembower)
- Date: Fri, 31 Oct 2008 13:34:05 -0400
(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?
Thanks in advance for your help.
-Kevin
Kevin Zembower
Internet Services Group manager
Center for Communication Programs
Bloomberg School of Public Health
Johns Hopkins University
111 Market Place, Suite 310
Baltimore, Maryland 21202
410-659-6139
.
- Follow-Ups:
- Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- From: John W. Krahn
- Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- From: Paul Johnson
- Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Prev by Date: merge 2 or more files together without creating new file
- Next by Date: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Previous by thread: merge 2 or more files together without creating new file
- Next by thread: Re: Why doesn't this work: perl -e "@s=([1,2],[3,4]); print $s[0][0];"
- Index(es):
Relevant Pages
|