Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic some one i need help (Read 2180 times)
throesch
God Member
*****
Offline


I will own you all. will
you be on the good list?

Posts: 561
Location: Arab
Joined: Nov 9th, 2001
Gender: Male
some one i need help
Apr 16th, 2002 at 2:00am
Print Post  
ok here is the problem i need a perl script that will load multiple lines form a txt file.
and it will also modify the lines.

example:

file.txt:
name|age|live
name2|age2|live2

so that each line will show up in a table in differnt places.

example:
|||||||||||||||||||||||||||||||||||
|||            |||         |||        |||
|||  name  |||  age  ||| live  |||
|||            |||         |||        |||
|||||||||||||||||||||||||||||||||||
|||            |||         |||        |||
||| name2 ||| age2 ||| live2 |||      
|||            |||         |||        |||
|||||||||||||||||||||||||||||||||||
  
Back to top
ICQYIM  
IP Logged
 
Shoeb Omar
God Member
*****
Offline


Mod Writer

Posts: 5665
Location: San Diego
Joined: Jun 29th, 2001
Gender: Male
Re: some one i need help
Reply #1 - Apr 16th, 2002 at 2:58am
Print Post  
writing on the fly here so u might ave to fix it a little Wink

Code
Select All
open (BLA, "file.txt")
@file = <BLA>;
close (BLA);
print "<table><tr>"
foreach $line (@bla){
($name, $age, $live) = split("/\|/", $line); #not sure if right
print <<"EOT";
<td>$name</td><td>$age</td><td>$live</td>
</tr><tr>
EOT
}
print "</tr></table>";
 



once again thisis rough code but should give ya an idea Smiley
  

YaBB SP2 BETA!
Now taking pay jobs in PHP or Perl.  Contact me for details.
Back to top
IP Logged
 
throesch
God Member
*****
Offline


I will own you all. will
you be on the good list?

Posts: 561
Location: Arab
Joined: Nov 9th, 2001
Gender: Male
Re: some one i need help
Reply #2 - Apr 16th, 2002 at 3:09am
Print Post  
ok that works for the out part but i need to make it open the file modify it and save it
  
Back to top
ICQYIM  
IP Logged
 
throesch
God Member
*****
Offline


I will own you all. will
you be on the good list?

Posts: 561
Location: Arab
Joined: Nov 9th, 2001
Gender: Male
Re: some one i need help
Reply #3 - Apr 16th, 2002 at 3:26am
Print Post  
ok i was just looking at the code and wont that only pull out one set of info so if it was

example:

throesch|19|alabama
bala|32|here

it would make it

<td>throesch</td><td>19</td><td>alabama</td>
<td>throesch</td><td>19</td><td>alabama</td>

instead of
<td>throesch</td><td>19</td><td>alabama</td>
<td>bala</td><td>32</td><td>here</td>
  
Back to top
ICQYIM  
IP Logged
 
Shoeb Omar
God Member
*****
Offline


Mod Writer

Posts: 5665
Location: San Diego
Joined: Jun 29th, 2001
Gender: Male
Re: some one i need help
Reply #4 - Apr 16th, 2002 at 3:33am
Print Post  
no, the foreach loops it through the file Smiley
  

YaBB SP2 BETA!
Now taking pay jobs in PHP or Perl.  Contact me for details.
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint