Greetings $Bill, > No excuse. Format it properly, compile it using 'use strict;' and 'use > warnings;' > till it has no errors (or produces the expected error) and then post it by > cutting and pasting into the email (from your text editor). If you don't > have a good text editor, I would go out and get one and learn it if you > plan on doing any amount of coding (Vim and Emacs are free, multi-platform > and very good products).
I have an editor that I think is pretty good (Optiperl) The problem is that when I paste it into the e-mail, the mail program (The Bat) makes a mess that can not be edited within the mail program. This is my only serious complaint about the bat and I am too committed to change programs. I did a lot of pre-editing to make it less of a mess. When I paste it in, it still messes up the indenting and I can not edit it without making a total mess. The pasted code is part of a much larger program that uses MIDI perl. All variables are declared and have appropriate scope. I simplified the following a little. My only question is why the same assignments to an array work fine in one way and not the other. I had two lines swapped in the original example but I had tested both orders and they worked the same so I made them consistent in this example so as to not call attention to that as a possible difference. I would like to figure out what causes the problem so I can find a solution faster the next time something like this happens. I re-wrote the code about 20 times before I tried moving the array assignment to another block. The various temporary arrays (on_off_time and note_array) are initialized and modified outside of the example shown and this all works as it should. To show what the program really does would require a very large example which would not make the problem clearer.Lists <[EMAIL PROTECTED]> if ( $dothis){ # this works correctly my $shiftticks = 100; $gapsize = $time - ($on_off_time_array3[$note]); if (($gapsize < $mingapticks) and ($on_off_time_array1[$note] >= 0 )){ $smallgaps ++; $notelength = ($on_off_time_array3[$note]) - ($on_off_time_array2[$note]); if ( ($notelength - $shiftticks) < $minnoteticks ){; # if a short note would be made then shift instead $shortnotes ++; if ( ($on_off_time_array2[$note] - $on_off_time_array1[$note]) > ($mingapticks + $shiftticks) ){ # if room to shift my $newtime2 = ($on_off_time_array3[$note]) - ($shiftticks) ; $shifted = 1; my $newtime = ($on_off_time_array2[$note]) - ($shiftticks) ; # shift the note on $on_off_time_array2[$note] = $newtime; my @replace2 = ('note_on', $newtime, $channel, $note, $vel ); # replacement previous off event ${ $tracks->[$i]->events_r }[ $notearray2[$note] ] = undef; push ( @{ $tracks->[$i]->events_r }, [EMAIL PROTECTED] ); } else{ $noroom = 1; #could not shrink nor shift so don't change any events $nofixgaps ++; } } $newtime = $time - $mingapticks; $newtime = $newtime2 if $shifted; $on_off_time_array3[$note] = $newtime; # save temporarily so array1 will get the value before updating it my @replace = ( 'note_on', $newtime, $channel, $note, 0 ); # replacement previous off event ${ $tracks->[$i]->events_r }[ $notearray3[$note] ] = undef unless $noroom; push ( @{ $tracks->[$i]->events_r }, [EMAIL PROTECTED] ) unless $noroom; } } if ( $dothis){ # this version doesn't work my $shiftticks = 100; $gapsize = $time - ($on_off_time_array3[$note]); if (($gapsize < $mingapticks) and ($on_off_time_array1[$note] >= 0 )){ $smallgaps ++; $notelength = ($on_off_time_array3[$note]) - ($on_off_time_array2[$note]); if ( ($notelength - $shiftticks) < $minnoteticks ){; # if a short note would be made then shift instead $shortnotes ++; if ( ($on_off_time_array2[$note] - $on_off_time_array1[$note]) > ($mingapticks + $shiftticks) ){ # if room to shift $newtime = ($on_off_time_array2[$note]) - ($shiftticks) ; # shift the note on $on_off_time_array2[$note] = $newtime; my @replace = ('note_on', $newtime, $channel, $note, $vel ); # replacement previous off event ${ $tracks->[$i]->events_r }[ $notearray2[$note] ] = undef; push ( @{ $tracks->[$i]->events_r }, [EMAIL PROTECTED] ); $newtime = ($on_off_time_array3[$note]) - ($shiftticks) ; $on_off_time_array2[$note] = $newtime; my @replace2 = ('note_on', $newtime, $channel, $note, 0 ); # replacement previous off event ${ $tracks->[$i]->events_r }[ $notearray3[$note] ] = undef; push ( @{ $tracks->[$i]->events_r }, [EMAIL PROTECTED] ); } else{ $newtime = $time - $mingapticks; $newtime = $newtime2 if $shifted; $on_off_time_array3[$note] = $newtime; my @replace = ( 'note_on', $newtime, $channel, $note, 0 ); # replacement previous off event ${ $tracks->[$i]->events_r }[ $notearray3[$note] ] = undef; push ( @{ $tracks->[$i]->events_r }, [EMAIL PROTECTED] ); } } } } -- Best regards, Spencer_Lists Chase mailto:[EMAIL PROTECTED] 67550 Bell Springs Rd. Garberville, CA 95542 Postal service only. Laytonville, CA 95454 UPS only. [EMAIL PROTECTED] http://www.spencerserolls.com http://www.spencerserolls.com/MidiValve.htm (707) 984-8356 _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs