Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Perl

Unregistered, Check out the Coder Battles in the Announcement and Game forums.

Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-12-2007, 02:16 PM
Cosmet Cosmet is offline
Learning Programmer
 
Join Date: Oct 2006
Posts: 58
Credits: 0
Rep Power: 8
Cosmet is on a distinguished road
Default Two Questions.....

Ok, the first question is how do I remove an element of an array? It can be any element.....

Second: how do I use while on an array?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 03-12-2007, 04:14 PM
xXHalfSliceXx's Avatar   
xXHalfSliceXx xXHalfSliceXx is offline
Co-Administrator
 
Join Date: Oct 2006
Location: Hendersonville, NC
Age: 24
Posts: 1,166
Credits: 0
Rep Power: 20
xXHalfSliceXx is on a distinguished road
Send a message via AIM to xXHalfSliceXx Send a message via MSN to xXHalfSliceXx Send a message via Yahoo to xXHalfSliceXx
Default

Q1308 How to you remove an element or item from an array (ie make it smaller)?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-13-2007, 01:18 AM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Credits: 0
Rep Power: 7
KevinADC is on a distinguished road
Default

xXHalfSliceXx,

That will work great for..... javascript arrays.

I would post a suggestion or two but Cosmet is in the habit of not replying to threads he starts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-13-2007, 03:38 PM
Cosmet Cosmet is offline
Learning Programmer
 
Join Date: Oct 2006
Posts: 58
Credits: 0
Rep Power: 8
Cosmet is on a distinguished road
Default

Sorry, once I get the answer I forget to reply thanks..... Please help! I'll reply this time.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 03-14-2007, 01:16 AM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Credits: 0
Rep Power: 7
KevinADC is on a distinguished road
Default

Code:
my $element = 'cat';
my @array = qw(dog pig cat bird);
@array = grep {$_ ne $element} @array;
print "@array";
Second, don't use "while" on an array, that is almost never appropriate. Use "for" or "foreach" or "map" or "grep" for processing arrays.

Last edited by xXHalfSliceXx; 03-14-2007 at 07:35 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 03-14-2007, 04:20 PM
Cosmet Cosmet is offline
Learning Programmer
 
Join Date: Oct 2006
Posts: 58
Credits: 0
Rep Power: 8
Cosmet is on a distinguished road
Default

Thank you for replying - I've been assigning the array values to "", is that good enough for erasing them?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 03-14-2007, 06:08 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Credits: 0
Rep Power: 7
KevinADC is on a distinguished road
Default

Depends on what you are doing, that just makes the array element an empty string, but the array will still be the same length as before because you did not delete the array element, just defined it as empty. Most likely that is not what you really want to do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 03-16-2007, 01:37 AM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Credits: 0
Rep Power: 7
KevinADC is on a distinguished road
Default

hmmm...another thread abandoned by cosmet, I should have learned my lesson. I have now.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 03-20-2007, 10:01 AM
Cosmet Cosmet is offline
Learning Programmer
 
Join Date: Oct 2006
Posts: 58
Credits: 0
Rep Power: 8
Cosmet is on a distinguished road
Default

Sorry, I sometimes go for days without getting on the net/computer. I've just now started working on this project again. Thank you for your suggestions, I managed to get them working well in my script.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
questions about java games stack Java Help 3 07-02-2007 05:35 PM
A few basic website questions ehudgershon General Programming 4 06-11-2007 02:20 PM
Adsense.. I have 2 questions TcM Search Engine Optimization 5 01-06-2007 12:05 AM
Questions about download tracking Nightracer PHP Forum 3 11-07-2006 07:43 PM
Where to ask vBullentin questions PC101 Website Design 4 09-19-2006 04:16 PM


All times are GMT -5. The time now is 11:33 PM.

Contest Stats

Xav ........ 1097.16
MeTh0Dz|Reb0rn ........ 986.37
morefood2001 ........ 850.04
John ........ 841.93
WingedPanther ........ 684.54
marwex89 ........ 638.26
Brandon W ........ 492.36
chili5 ........ 292.12
orjan ........ 187.41
Steve.L ........ 186.37

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 79%

Ads