[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-WebCGI] Push Problem Revisited...



At 8:32 PM -0400 7/26/99, Randy M. Zeitman wrote:
>When I push an array, no problem, but when I push the reference of an array
>I get an server error...here's the example. Thanks for the patience.
>-------------------
>#!/usr/bin/perl
>print "Content-type:text/html\n\n";
>
>@a = ("1","2","3");
>@b = ("5","6","7");
>
>push (@a, [@b]);
>
>print $#a;
>-------------------
>But if I did push (@a, @b); it's ok....
>
>

Try this:

#!/usr/bin/perl
print "Content-type:text/html\n\n";

@a = ("1","2","3");
@b = ("5","6","7");
$ref = [@b];
push (@a, @$ref);
print "$#a", "\n";

If you'll pardon me, let's throw in a reference to a constant (4), 
and let's look inside the array to make sure we got what we wanted, 
plus it seems so _laden_ with those double quotes,...

#!/usr/bin/perl
print "Content-type:text/html\n\n";

@a = qw(1 2 3);
@b = qw(5 6 7);
$b_ref = [@b];
$c_ref = \4;
push (@a, $$c_ref);
push (@a, @$b_ref);
print "$#a\n@a\n";

Good luck!

1;



- Bruce

# ~~~~~~~~~~~~~~~~~~~
# Bruce Van Allen
# bva@cruzio.com
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Director
# WireService, an Internet service bureau
# Serving the educational and nonprofit sectors
# wire@wireservice.org
# http://wireservice.org
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-webcgi-request@macperl.org