1 #Open file matching ex.1; 2 open (C, ">all.txt") || die "output"; #### use warnings; use strict; #### 10 @firstgrouping = split(/, |,\s|,\t|,|\s,|\t,| ,/, $line2); #### 12 @actualsyll = split(/\d |\d\s|\d\t|\d|\s\d| \d|\t\d|\t\d\t|\s\d\s| \d /, $firstgrouping[2]); #### 20 open (A, "<$file") || die "files"; #### 25 $line1 =~ s/^ |^ |^\s\s\s|\s{3,4}//; #### 27 chomp; #### 29 foreach ($line1 =~ /^\d/g) { #### 29 if ( $line1 =~ /^\d/ ) { #### 31 if ($line1 =~ /\d\s\w|\d\s{1,2}\d|\d\s\s\d|\d \d|;\s\w/gi) { #### 32 $line1 =~ s/\s| |\s\s| |\s{2}/\t/g; #### 33 $line1 =~ s/\t\t|\t{2}/\t/; #### 40 $spoke =~ s/\s{1,}$|\t{1,}$//g; #### 54 }}}} 55 close A; #### #!/usr/bin/perl use warnings; use strict; # Open file matching ex.1 open C, '<', 'dic.txt' or die "dic.txt: $!"; # open file to write to open B, '>>', 'all.txt' or die "all.txt: $!"; # Making a loop of all lines in example 1 file while ( my $line2 = ) { # Getting rid of the newline chomp $line2; # Split all lines my $firstgrouping = ( split /\s?,\s?/, $line2 )[ 2 ]; # splitting the lines in $firstgrouping[2] by the numbers so that text before and after number are different indexed scalars my @actualsyll = split /\s?\d\s?/, $firstgrouping; # Printing the new version of @firstgrouping[2] print B "@actualsyll\n"; } close C; # Loop gets all files matching ex. 2 opens them my @array3; for my $file ( ) { open A, '<', $file or die "$file: $!"; # Making a loop of all lines in each file while ( my $line1 = ) { # There are headers with information I do not need so this essentially cuts them out $line1 =~ s/^ {4}|^\s{3}|\s{3,4}//; # Chomping of the newline chomp $line1; next unless $line1 =~ /^\d|[\d;]\s\w|\d\s{2}\d/; $line1 =~ s/\s/\t/g; $line1 =~ s/\t\t/\t/; my $orth = ( split / <|>;|\t/, $line1 )[ 2 ]; # Getting rid of some additional extraneous material $orth =~ s/;//; push @array3, $orth; } close A; } # Making a loop of each array created above for my $shift3 ( @array3 ) { # Prints out the $orth word of each line on its own line (used mostly as a debugger right now) print B "$shift3\n"; }