my $i = 0; foreach (@ARGV) { if ($i == 0) { print "$_"; $i = 1; } else { print ", $_"; } } #### print join ', ', @ARGV; #### my $new_act; my $new_scene; while (<$playIn>) { my $line = $_; ... # Print the act heading if we haven't yet. if ($new_act) { print "$new_act\n"; $new_act = undef; } # Print the scene headin if we haven't yet. if ($new_scene) { print "$new_scene\n"; $new_scene = undef; } ... # Step 1.6: We should also print act headings. elsif ($line =~ m/.*

ACT \w+.*/) { $new_act = $line; } # Step 1.7: We should also print scene headings. elsif ($line =~ m/.*

SCENE \w+.*/) { $new_scene = $line; } } #### open my $playIn, '<', $mit_shakes or die "Could not open '$mit_shakes': $!\n";