Re: What is the difference between () and [] syntax for array?

2013-01-07 Thread *Shaji Kalidasan*
Neo, The primary difference is that, the first one is an array of 3 elements and second is an array containing one element which in turn is a reference (an anonymous array). This is probably best explained by an example. [code] use strict; use warnings; use Data::Dumper qw/Dumper/; my @a1 = (

Re: What is the difference between () and [] syntax for array?

2013-01-07 Thread Michael Brader
On 01/08/2013 12:03 PM, Neo Anderson wrote: > I think there are two ways to declare an array: > my @a1 = (1, 2, 3);my @a2 = [1, 2, 3]; > What is the difference? The first declares an array with three elements 1, 2 and 3. The second declares an array with 1

Re: What is the difference between () and [] syntax for array?

2013-01-07 Thread Feng He
于 2013-1-8 9:33, Neo Anderson 写道: > I think there are two ways to declare an array: > my @a1 = (1, 2, 3);my @a2 = [1, 2, 3]; > What is the difference? The first is an array. The second is a reference to the array. And you should define the second with: my $a2 = [1,2,3]; $a2 is a scalar not an arra

Re: What is the difference between () and [] syntax for array?

2013-01-07 Thread Jim Gibson
On Jan 7, 2013, at 5:33 PM, Neo Anderson wrote: > > I think there are two ways to declare an array: > my @a1 = (1, 2, 3);my @a2 = [1, 2, 3]; > What is the difference? Both "my @a1;" and "my @a2" DECLARE an array. The difference here is what you are ass

Re: What is the difference between () and [] syntax for array?

2013-01-07 Thread Parag Kalra
On Mon, Jan 7, 2013 at 5:33 PM, Neo Anderson wrote: > > my @a1 = (1, 2, 3); > Here we are actually storing the elements into the array. > my @a2 = [1, 2, 3]; > And in this case we are storing the reference to the array containing elements 1, 2 and 3. This should actually be: my $a2 = [1, 2,

What is the difference between () and [] syntax for array?

2013-01-07 Thread Neo Anderson
I think there are two ways to declare an array: my @a1 = (1, 2, 3);my @a2 = [1, 2, 3]; What is the difference?

Re: Substituting letters for numbers

2013-01-07 Thread Uri Guttman
On 01/07/2013 12:41 PM, Andy Bach wrote: On Thu, Jan 3, 2013 at 3:37 AM, Hamann, T.D. wrote: and then using a second regular expression to remove the space, but that somehow seems silly. Surely there is a quicker way to do this? s/(i)(\d\d)(o)/1${2}0/; One route, esp. if there might be mor

Re: Substituting letters for numbers

2013-01-07 Thread Andy Bach
On Thu, Jan 3, 2013 at 3:37 AM, Hamann, T.D. wrote: > > and then using a second regular expression to remove the space, but > > that somehow seems silly. Surely there is a quicker way to do this? > > s/(i)(\d\d)(o)/1${2}0/; > One route, esp. if there might be more letter<->number pairs (like "lee

Re: bool test return issues

2013-01-07 Thread David Precious
On Sat, 5 Jan 2013 09:01:26 -0700 Elim Qiu wrote: > perl shell is a good idear (I'm using ipython a lot. That's why I like > to try perl shell), but it really has problems. See attached > screenshot. Ah. Yeah, that's a different animal to Perl. This list can help you with problems with Perl, b

Re: bool test return issues

2013-01-07 Thread Brandon McCaig
Hello: On Sat, Jan 05, 2013 at 09:01:26AM -0700, Elim Qiu wrote: > perl shell is a good idear (I'm using ipython a lot. That's why I like > to try perl shell), but it really has problems. See attached > screenshot. I think you forgot to mention that you were using this psh. :) That or I missed it