Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Apr 29th, 2005, 9:50 AM   #1
blackmagic
Newbie
 
Join Date: Apr 2005
Posts: 1
Rep Power: 0 blackmagic is on a distinguished road
How To Split Array Into Two Seperate Arrays?

I was wondering how, if i had an array of a fair few values (say about 20 for arguments sake), called @example

How would i divide this array into two seperate arrays, as in, the first 5 values of the array were in @part1 and the second 15 in @part2. Is there a function, or failing that a good method to do this.

The context in which i am asking, is i wish to read the contents of a text file, and edit 5 or so lines in the middle, but leave the rest the same. I plan to do this by reading the whole text file into an array:

open(INFILE,">empayslips.txt");
my @wholefile = <INFILE>;
...

I then plan to split the array into all the values before the data i want to edit and all the data i don't want to edit (this will likely need to be done with two 'splits').

Anyhow, if you know how to divide arrays like afforementioned, any assistance would be greatly appreciated.
blackmagic is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 1:03 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC