What I would like to be able to do is read in all of the PER info and EMP info where the first field (A1 or A2) are matching and then put them into a similar hash and thus come through with the following output."PER" "A1" "Denise Johnson" "red,orange,yellow" 09/25/2001 "PER" "A2" "Desiree Smith" "yellow,blue-green" 03/06/1970 "EMP" "A1" "X & Y Bank" "Teller" 05/17/1994 "Brian's Point" "WI" 54997 24000 +.00 "EMP" "A2" "Acme Corp" "Computer Programmer" 07/24/1997 "Maxwell" "WI" 53224 + 45000.00 "EOS"
Here is my code so far, but it is not giving me the correct result (actually it is giving me NO RESULT). Please help me if you can, but do not laugh to hard at me, please....--------------------- Entity = A1 Name = Denise Johnson Color = red Color = orange Color = yellow Date = 09/25/2001 ---------------------- Entity = A2 Name = Desiree Smith Color = yellow Color = blue-green Date = 03/06/1970 ------------------------ Entity = A1 Employment = X & Y Bank Job Title = Teller Date of Hire = 05/17/1994 Location = Brian's Point, WI 54997 Salary = 24000.00 ------------------------ Entity = A2 Employment = Acme Corp Job Title = Computer Programmer Date of Hire = 07/24/1997 Location = Maxwell, WI 53224 Salary = 45000.00
I do need to use the PER and EMP as seperators to sort out the data, so if you could tell me a way to put this information together without to much stress that would be great. Anything you could do to help out would be awesome at this point. peace, LOVE and ((hugs)) as always dez L#!/usr/bin/perl-Tw use strict; use Text::ParseWords; open(DATA,"basicdez.dat") || die "Cannot open datfile: $!\n"; my @data; my $i = 0; my $new_record = 0; while (<DATA>) { chomp; last if /^"EOS"$/; { @data = "ewords('\s+', 0, $_); } if ((/^PER\s*$/) && ($data[0]) && ($data[1]) && ($data[2]) && ($data +[3])) { my @colors=split(/,/, $data[2]); print "---------------------\n"; print "Entity = $data[0]\n"; print "Name = $data[1]\n"; for (@colors){ # print each color print "Color = $_\n"; print "Date = $data[3]\n"; } if ((/^EMP\s*$/) && ($data[0]) && ($data[1]) && ($data[2]) && ($data +[3]) && ($data[4]) && ($data[5]) && ($data[6]) && ($data[7])) { print "------------------------\n"; print "Entity = $data[0]\n"; print "Employment = $data[1]\n"; print "Job Title = $data[2]\n"; print "Hire Date = $data[3]\n"; print "Location = $data[4], $data[5] $data[6]\n"; print "Salary = $data[7]\n"; } } }
In reply to Help with creating output to screen... by basicdez
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |