Listing 4. Entering VRNs with enter_vrn.pl.
0 #!/usr/bin/perl -w
1 # -*- perl -*-
2 # enter_vrn.pl
3 use strict;
4 use DBI;
5 my $db = DBI->connect('dbi:mysql:CEA')
or die "Can't connect: $DBI::errstr";
6 my $stl = $db->prepare(
'INSERT INTO registration (registration_id) VALUES (?)' )
7 or die "Can't prepare: ",$db->errstr;
8 $/ = ""; # paragraph mode
9 while (<>) {
10 chomp;
11 my ($digits) = /--REGISTRATION-START--(.+)--REGISTRATION-END--/s;
12 $digits =~ s/\D//g;
13 $stl->execute($digits) or die $db->errstr;
14 }
15 $stl->finish;
16 $db->disconnect;