#!/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"; }