Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!usr/bin/perl -w
- #William Whitehead
- #$date
- #Engr 212
- my $in_file = 'cn.txt';
- open my $in_fh, '<', $in_file or die "Could not open file $in_file: $!";
- my $out_file = 'liboutput.txt';
- open my $out_fh, '>', $out_file or die "Could not open file $out_file: $!";
- while ( my $line = <$in_fh> ) {
- print {$out_fh} $line if $line =~ /\|LIB\|/;
- }
- close $in_fh or die "Could not close file $in_file: $!";
- close $out_fh or die "Could not close file $out_file: $!";
- my $in_file = 'liboutput.txt';
- open my $in_fh, '<', $in_file or die "Could not open file $in_file: $!";
- my $out_file = 'caoutput.txt';
- open my $out_fh, '>', $out_file or die "Could not open file $out_file: $!";
- while ( my $line = <$in_fh> ) {
- print {$out_fh} $line if $line =~ /\|CA\|H\|/;
- }
- close $in_fh or die "Could not close file $in_file: $!";
- close $out_fh or die "Could not close file $out_file: $!";
- open (FILE, 'caoutput.txt');
- while (<FILE>) {
- chomp;
- ($id, $name, $party, $year, $state, $office, $district, $status1, $status2, $pcc, $address, $address2, $city, $state, $zip) = split(/\|/);
- print "Name: $name\n";
- print "Address: $address\, $address2$city\, $state $zip \n";
- print "---------\n";
- }
- close (FILE);
- exit;
Advertisement
Add Comment
Please, Sign In to add comment