Hi All,
 
I have a database file, some_sch.txt that is arranged like this:
 
username1
First Last
Some Community Sch  
1000 S Adams St
Town, Indiana 12345 U.S.A. 
 
username2
First Last 
Some Community Sch 
1000 S Adams St
Town, Indiana 12345 U.S.A. 
  
username3
First Last 
Some Community Sch  
1000 S Adams St
Town, Indiana 12345 U.S.A.
 
I want the file to look like this:
 
username1    First Last    sch_name     1000 S Adams St    Town,Indiana
12345 U.S.A.
username2    First Last    sch_name     1000 S Adams St    Town,Indiana
12345 U.S.A.
username3    First Last    sch_name     1000 S Adams St    Town,Indiana
12345 U.S.A.
 
I don't know how to create a loop that will assign each scalar variable
to the next line (field).  Here is what I have so far....  Any suggestions
or hints, would be greatly appreciated!
 
Thanks!
 
#!/usr/bin/perl -w
 
use strict;
 

my $datafile = "C:/brian/marion_sch.txt";
open (IN, $datafile); 
while (<IN>) { 
    chomp; 
 
    my ($user_name, $full_name, $cust_name, $address, $cszc, $blank_line) =
    (split // );
    write;  
}
 
format STDOUT =
@<<<<<<<<<<<<< @>>>>>>>>>>>>>>>> @<<<<<<<<<<<<<<<
my $user_name, my $full_name, my $cust_name
.
 
close IN;
 
 
 
Brian Volk
HP Products
317.298.9950 x1245
 <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
 
 

Reply via email to