basicdez has asked for the wisdom of the Perl Monks concerning the following question:
I have somewhat of a dilemma here. If I read in the following file... named basicdez.dat
with the following perl logic..."Jane""Doe" "123 W Beverly Ave" "Talahasee""Maine" "222-22-2222" "EOS"
What I would expect would be something as follows...#!/usr/bin/perl use strict; my $i; my $data; open(DATA," basicdez.dat") || die "Cannot open datfile: $!\n"; while(<DATA>){ chomp; unless ($_=~ /"EOS"/){ $data .= "$_"; } elsif ($i ne 1) { $data .="\n"; } if ($_=~ /"EOS"/){ $i=1; } } close(DATA); my @data=split(/\n/, $data); for(@data){ my($first_name,$last_name,$address,$city,$state,$phone)=split; print "$first_name,$last_name\n"; print "$address\n"; print "$city, $state\n"; print "$phone \n"; } exit;
However, what I am getting is the following...Jane, Doe 123 W Beverly Ave Talahasee,Maine 222-22-2222
Please help me out on this one as I am most entirely confused. I thank you in advance for any assistance on this issue and apologize for my ignorance in what should be a simple matter. peace dez L"Jane""Doe","123 W Beverly, Ave" "Talahasee""Maine"
Back to
Seekers of Perl Wisdom