#!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my ($inp_line, $num_addr, $dir_addr, $str_addr, $city_addr, $zip_addr, $junk, $name, $junk2) = ''; my $inp_file = shift @ARGV || die "\nusage: $0 inpfile\n"; open (INP, "$inp_file") or die "\nCan't open file [$inp_file]: $!\n"; my $workbook = Spreadsheet::WriteExcel->new("$inp_file.xls"); my $worksheet = $workbook->addworksheet(); $worksheet->write(0,0,"NAME"); $worksheet->write(0,1,"ADDRESS"); $worksheet->write(0,2,"CITY"); $worksheet->write(0,3,"ZIP"); my $row = 2; my $temp = ''; while () { chomp; ($num_addr,$dir_addr,$str_addr,$city_addr,$zip_addr,$junk,$name,$junk2) = split /\",\"/; $num_addr =~ /^\"(.*)$/; $num_addr = $1; $worksheet->write($row,0,$name); if ($dir_addr){ ($temp = $num_addr . " $dir_addr" . " $str_addr") }else { ($temp = $num_addr . " $str_addr"); } $worksheet->write($row,1,$temp); $worksheet->write($row,2,$city_addr); $worksheet->write($row,3,$zip_addr); ++$row; } close (INP);