![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| split and making an array inside another array | dcfargo | Shell Programming and Scripting | 2 | 08-06-2008 11:07 AM |
| [KSH] Split string into array | piooooter | Shell Programming and Scripting | 3 | 09-01-2007 01:22 PM |
| How to get array to not split at spaces? | jjinno | Shell Programming and Scripting | 1 | 07-20-2007 01:06 AM |
| split to array in perl | jaganadh | Shell Programming and Scripting | 3 | 07-06-2007 06:29 AM |
| How To Sort Array of Hashes ?? | coolguyshail | Shell Programming and Scripting | 3 | 05-09-2005 10:31 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Array split function & hashes
Hi,
If this is the array that is being returned to me: Quote:
This works for 1 Record: Code:
foreach $item (@results)
{
($id, $id2, $name, $date, $email) = split(/\|/, $item, 5);
print "$name<br>";
}
|
|
||||
|
Code:
open(FH,"<filename");
while(<FH>){
@arr=split(/\\n/,$_);
for($i=0;$i<$#arr;$i++){
($id, $id2, $name, $date, $email)=split(/\|/,$arr[$i]);
printf("Name:%s,ID1:%s,ID2:%s,Email:%s\n",$name,$id,$id2,$email);
}
}
close(FH);
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|