RE: Adding to multi-dimensional array dynamically via push...

2003-01-16 Thread Liss, Mike
ry 16, 2003 4:27 PM To: Liss, Mike Cc: '[EMAIL PROTECTED]' Subject: Re: Adding to multi-dimensional array dynamically via push... push( @MyArray[ 0 ], 0 ); Hi Mike, I think you need to make up your mind who's doing the work here--you or Perl. The stack functions, push and pop, are i

Re: Adding to multi-dimensional array dynamically via push...

2003-01-16 Thread R. Joseph Newton
push( @MyArray[ 0 ], 0 ); Hi Mike, I think you need to make up your mind who's doing the work here--you or Perl. The stack functions, push and pop, are intended to let the array handle its own organization, while you concern yourself only with the top element [ie the one most recently insert

Re: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Rob Dixon
Rob Dixon wrote: > If you want to use push, pop, shift, unshift etc then do > > push @$MyArray[$i], $val Sorry: push @{$MyArray[$i]}, $val > > which (if the array was previously empty) will set $MyArray[$i][0] to > $val. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional com

Re: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread John W. Krahn
Mike Liss wrote: > > Hello, Hello, > I would like to know if it is possible to do somthing like this: > > ( I know I can't do it this way as Perl barfs when I tried it ) > > > $SizeOfMyArray = 2; > > $MyArray[ $SizeOfMyArray ]; If you want to pre-allocate the array size the proper way to do

Re: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Rob Dixon
Mike Liss wrote: > I am trying to create a multi-dimensional array > > $MyArray[ $SizeOfMyArray ]; > You don't do that in Perl. There is no equivalent to BASIC's DIM statement. > > So I can do this: > > print " $MyArray[ 0 ][ 0 ] \n"; You can do exactly that if you want to. The array will automa

RE: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread david
Mike Liss wrote: > > I am trying to create a multi-dimensional array > > $MyArray[ $SizeOfMyArray ]; > > So I can do this: > > print " $MyArray[ 0 ][ 0 ] \n"; > > > And what I want to do is add items to the array dynamically in Perl, multi-dimensional array is usually implemented with array

RE: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Dan Muey
> To: 'Mark Anderson'; [EMAIL PROTECTED] > Subject: RE: Adding to multi-dimensional array dynamically via push... > > > > I am trying to create a multi-dimensional array > > $MyArray[ $SizeOfMyArray ]; > > So I can do this: > >

RE: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Liss, Mike
ED]] Sent: Wednesday, January 15, 2003 1:47 PM To: Liss, Mike; [EMAIL PROTECTED] Subject: RE: Adding to multi-dimensional array dynamically via push... > I would like to know if it is possible to do somthing like this: ( I > know I can't do it this way as Perl barfs when I tried it ) &

RE: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Mark Anderson
> I would like to know if it is possible to do somthing like this: > ( I know I can't do it this way as Perl barfs when I tried it ) > > $SizeOfMyArray = 2; > > $MyArray[ $SizeOfMyArray ]; Why are you trying to define the size of your array? > push( @MyArray[ 0 ], 0 ); << --- complains

Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Liss, Mike
Hello, I would like to know if it is possible to do somthing like this: ( I know I can't do it this way as Perl barfs when I tried it ) $SizeOfMyArray = 2; $MyArray[ $SizeOfMyArray ]; push( @MyArray[ 0 ], 0 ); << --- complains here with < ERROR > (see below ) push( @MyArray[ 1