Brian Volk wrote:
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).
This, I think, is an easier approach:
local $/ = ''; # enables "paragraph mode"
while (<IN>) {
my @rows = split /\n/;
print join("\t", @rows), "\n";
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>