#!/usr/bin/perl -w # use warnings! use strict; # suck the entire file into an array, rather than just # putting it into a file. open(DATA," basicdez.dat") || die "Cannot open datfile: $!\n"; my @data = ; close(DATA); # remove your eof element. If you can help it, take it out of the # dat file completely, so you can remove this line of code. @data = @data[0..@data-1]; # name and scope your loop variable for my $data (@data) { # remove those pesky quotes. If you can help it, take those out # of the dat file too! If i remember correctly, they are # needed in vb; however, Perl isn't a weak language like # vb is. It can handle raw text ;) You should delimit # your text with a single obscure character (the standard # obscure character (the standard for flat dbs is the # pipe | symbol.) # However, given your data as it is now, this will work: $data =~ s/" "/""/g; $data =~ s/""/|/g; $data =~ tr/"//d; # split on the newly created pipe delimited entry. my($first_name,$last_name,$address,$city,$state,$phone) = split /\|/, $data; print "$first_name,$last_name\n"; print "$address\n"; print "$city, $state\n"; print "$phone \n"; }