Ah, much better! We don't care what your code looks like (actually, that's a lie) so long as you are prepared to take some advice and improve. This is lovely code - there is a ton of room for improvement. ;)
First off, always use strictures (use strict; use warnings;). Don't use $a and $b as variables - they are special (used by sort). Avoid the C style for loop - Perl's for loop is safer, clearer and cleaner.
Generally if you have parallel data try to use a single data structure for it so you don't have to double handle everything with the resultant duplication of code and much greater risk of errors.
Bearing that in mind consider:
use strict;
use warnings;
my $str1 = "a b c d e f g h i j";
my $str2 = "1 3 45 65 7 89 67 9 8 2";
my @seq = split (' ', $str1);
my @arr = split (' ', $str2);
my @data = map {[$seq[$_], $arr[$_]]} 0 .. $#seq;
my $beg = 0;
my $end = 0;
for (@data) {
last unless $_->[1] < 15;
$beg++;
}
for (reverse @data) {
last unless $_->[1] < 15;
$end++;
}
print join (' ', map {$data[$_][0]} $beg .. $#arr - $end), "\n";
print join (' ', map {$data[$_][1]} $beg .. $#arr - $end), "\n";
Perl reduces RSI - it saves typing
|