-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathireg.pl
More file actions
75 lines (66 loc) · 1.18 KB
/
ireg.pl
File metadata and controls
75 lines (66 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/perl -w
# script to take excel csv file and output xml for evw.
# swain, ampira, 2003 january
# $Id: ireg.pl,v 1.1 2003/01/20 22:26:28 swain Exp $
use strict;
my $ctr;
open FILE, $ARGV[0] or die $!;
# create array of column names. yay.
my @cols;
my $i = 0;
while (<DATA>) {
chomp;
$cols[$i++] = $_;
}
print "I have $#cols columns.\n";
while (<FILE>) {
$ctr++;
#chomp;
# chomp causes a bug.. it doesn't remove \r
s/\r//g;
s/\n//g;
my @fields = split /,/;
print "length: $#fields\n";
if ($#fields != $#cols) {
warn "Oops, line imported from Excel had wrong number of fields.\n";
warn "(it had $#fields, was expecting $#cols\n";
}
for my $x (0..$#fields) {
print "$cols[$x]: $fields[$x]\n";
}
print "----------------------------\n";
}
print "read in $ctr lines.\n";
__END__
package_name
record_id
domain_name
user_name
password
hint_question
hint_answer
first_name
last_name
master_acct_name
email
phone
fax
address_1
address_2
city
state
foreign_state
zip
country
bill_address_1
bill_address_2
bill_city
bill_state
bill_foreign_state
bill_zip
bill_country
cc_name
cc_type
cc_number
cc_exp_date
cc_clear_number