Ask a Question related to PERL Beginners, Design and Development.
-
Richard Markham #1
removing all elements in an array
How can I simply remove all elements in an array, given that the array
is global and a procedure defines the elements to where the total
number of elements in this array could be very well be less.
I have tried @array = (); but this seems to affect the arrary in that
it wont take any element assignments afterwards.
Do I need to iterate through each element and blank the out?
Richard Markham Guest
-
Removing duplicate elements from an XML file
Is there an easy way of removing duplicate elements in an XML file. For example if I have three elements like: <incident id="GDOT-INC-252421"... -
Removing elements from associate array.
Elo! I've got a problem with removing elements from associate array (php). Above you'll find a schematic structure of my array: ARRAY ------... -
Accessing elements in array ref of array references
Currently I'm comparing the first value of each of the array references (which are stored in an array reference $ref_ref) as follows: ... -
[PHP] Removing array element by key
On Friday 11 July 2003 04:50, jwulff wrote: unset() -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems... -
Removing array element by key
How do i remove an element of an array by its key? I've tried array_s(p)lice to no avail. Either it chops too much or too little with seemingly... -
Randy W. Sims #2
Re: removing all elements in an array
On 2/4/2004 10:27 PM, Markham, Richard wrote:
@array = ();> How can I simply remove all elements in an array, given that the array
> is global and a procedure defines the elements to where the total
> number of elements in this array could be very well be less.
>
> I have tried @array = (); but this seems to affect the arrary in that
> it wont take any element assignments afterwards.
>
> Do I need to iterate through each element and blank the out?
>
is what you want. What kind of assignments are producing errors, and
what errors are you getting?
Randy.
Randy W. Sims Guest
-
Jeff 'Japhy' Pinyan #3
Re: removing all elements in an array
On Feb 4, Markham, Richard said:
Then you're doing something wrong.>How can I simply remove all elements in an array, given that the array
>is global and a procedure defines the elements to where the total
>number of elements in this array could be very well be less.
>
>I have tried @array = (); but this seems to affect the arrary in that
>it wont take any element assignments afterwards.
@array = ();
is the proper way to do it. Show us your code.
--
Jeff "japhy" Pinyan [email]japhy@pobox.com[/email] [url]http://www.pobox.com/~japhy/[/url]
RPI Acacia brother #734 [url]http://www.perlmonks.org/[/url] [url]http://www.cpan.org/[/url]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
Jeff 'Japhy' Pinyan Guest
-
Wolf Blaum #4
Re: removing all elements in an array
For Quality purpouses, Markham, Richard 's mail on Thursday 05 February 2004
04:27 may have been monitored or recorded as:
well> How can I simply remove all elements in an array, given that the array
> is global and a procedure defines the elements to where the total
> number of elements in this array could be very well be less.
>
> I have tried @array = (); but this seems to affect the arrary in that
> it wont take any element assignments afterwards.
>
---snip---
#!/usr/bin/perl
use strict;
use warnings;
my @array=qw/1 2 3 4 5 6 a s d f g/;
print "Length for blank: ", scalar @array,"\n";
print "$_ " foreach (@array);
@array=();
print "\nLength after blank: ", scalar @array,"\n";
---snap---
does it.
@array=(); is the way to go:
I guess your proble is somewhere else.
"...making easy thigs easy and hard things possible" - heavans no!> Do I need to iterate through each element and blank the out?
wolf
Wolf Blaum Guest



Reply With Quote

