RE: data structure question (corrected)

2004-10-18 Thread Joseph Discenza
Lasher, Brian wrote, on Monday, October 18, 2004 9:43 AM
:  is there a really good way to push a scalar onto that array in a
:  subroutine without copying the entire array
:  
:  sub Subroutine
:  {  my $self   = shift;
: my $list   = $self->{LIST};
: my $scalar = 6;
:  
: push $$list, $scalar;
:  
:  
:  }
:  
:  above code gives me arg1 must be ARRAY error.

Perhaps you meant "push @$list, $scalar;". I believe you can just do this:

push @{$self->{LIST}}, $scalar;

without even having to copy out the reference.

Good luck,

Joe

==
  Joseph P. Discenza, Sr. Programmer/Analyst
   mailto:[EMAIL PROTECTED]
 
  Carleton Inc.   http://www.carletoninc.com
  574.243.6040 ext. 300fax: 574.243.6060
 
Providing Financial Solutions and Compliance for over 30 Years
* Please note that our Area Code has changed to 574! *  



___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


RE: data structure question (corrected)

2004-10-18 Thread Lasher, Brian

If I have an object that has an array as one of its properties...

i.e. $obj->{LIST} = [ 1,2,3,4,5 ];

is there a really good way to push a scalar onto that array in a
subroutine without copying the entire array

sub Subroutine
{  my $self   = shift;
   my $list   = $self->{LIST};
   my $scalar = 6;

   push $$list, $scalar;


}

above code gives me arg1 must be ARRAY error.

-brian

Brian Lasher
Catalog DSP Product Engineering
Best Practices and Yield Enhancement Team
[EMAIL PROTECTED]
281-274-2913(W)
281-684-4699(C)
713-664-6240(H)
281-274-2279(F)


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


data structure question

2004-10-18 Thread Lasher, Brian
If I have an object that has an array as one of its properties...

i.e. $obj->{LIST} = [ 1,2,3,4,5 ];

is there a really good way to push a scalar onto that array in a
subroutine without copying the entire array

sub Subroutine
{  my $self   = shift;
   my $list   = $obj->{LIST};
   my $scalar = 6;

   push $$list, $scalar;


}

above code gives me arg1 must be ARRAY error.

-brian

Brian Lasher
Catalog DSP Product Engineering
Best Practices and Yield Enhancement Team
[EMAIL PROTECTED]
281-274-2913(W)
281-684-4699(C)
713-664-6240(H)
281-274-2279(F)


___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

___
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs