Hari,
Joseph is hitting it on the head... *warning sloppy code ahead* the following code worked like a champ for me on all the provided inputs...
@str = ("250 80707 13 294 8",
"332 0 286 5 428 0",
"332 0 286 5 428 0",
"414 9 428 0 797 ",
"333 0 781 2 458 9 ",
"414 01286 9 784 7 ",
"280 9 428 0 281 0 ",
"428 0 487 0 458 0 ",
"486 797 ",
"239 5 789 00 269 9 ",
"239 5 789 00 269 9 ",
"281 0 ",
"250 82707 15 401 9 ",
"486 286 9 250 00788 30787 2 ",
"486 286 9 250 00788 30787 2 ",
"707 0 788 20 340 ",
"707 0 788 20 340 ",
"788 20496 ",
"788 20496 ",
"812 20",
"719 45781 2 ",
"707 14788 21 414 9 355 8 344 1 ",
"707 14788 21 414 9 355 8 344 1 ",
"805 4 724 2 781 2 719 41",
"788 30781 2 427 31820 8 ",
"428 0 401 9 781 2 ",
"239 0 787 2 998 3 427 31511 9 ",
"894 1 788 29 599 0 716 99",
"894 1 788 29 599 0 716 99");
foreach $str (@str){
my $num = '6';
for(my $i = 0; $i <= 42; $i += 6) {
if($i eq '18'){
$num = '7';
} else {
$num = '6';
}
print substr($str, $i, $num);
unless($i eq '12'){
print " ";
}
if ($i eq '18'){
$i++;
}
}
print "\n";
}
-----Original Message-----
From: Krishna, Hari [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 25, 2002 10:37 AM
To: 'Sisyphus'; [EMAIL PROTECTED]
Subject: RE: Terrible at my logic
The length has no significance as far as I am concerned. But each set of
numbers belong to A line only.
So the length of each input line may vary.
Let me post how the input file looks like.
250 80707 13 294 8
332 0 286 5 428 0
332 0 286 5 428 0
414 9 428 0 797
333 0 781 2 458 9
414 01286 9 784 7
280 9 428 0 281 0
428 0 487 0 458 0
486 797
239 5 789 00 269 9
239 5 789 00 269 9
281 0
250 82707 15 401 9
486 286 9 250 00788 30787 2
486 286 9 250 00788 30787 2
707 0 788 20 340
707 0 788 20 340
788 20496
788 20496
812 20
719 45781 2
707 14788 21 414 9 355 8 344 1
707 14788 21 414 9 355 8 344 1
805 4 724 2 781 2 719 41
788 30781 2 427 31820 8
428 0 401 9 781 2
239 0 787 2 998 3 427 31511 9
894 1 788 29 599 0 716 99
894 1 788 29 599 0 716 99
Here's how my output should look like:
250 80 707 13 294 8
332 0 286 5 428 0
332 0 286 5 428 0
414 9 428 0 797
333 0 781 2 458 9
414 01 286 9 784 7
280 9 428 0 281 0
428 0 487 0 458 0
486 797
239 5 789 00 269 9
239 5 789 00 269 9
281 0
250 82 707 15 401 9
486 286 9 250 00788 30 787 2
486 286 9 250 00788 30 787 2
707 0 788 20 340
707 0 788 20 340
788 20 496
788 20 496
812 20
719 45 781 2
707 14 788 21 414 9 355 8 344 1
707 14 788 21 414 9 355 8 344 1
805 4 724 2 781 2 719 41
788 30 781 2 427 31820 8
428 0 401 9 781 2
239 0 787 2 998 3 427 31 511 9
894 1 788 29 599 0 716 99
894 1 788 29 599 0 716 99
But MY LOGIC GIVES ME THE FOLLOWING OUTPUT (Iam cutting an pasting from the
wordpad exactly as is..):
250 80 707 13 294 8
332 0 286 5 428 0
332 0 286 5 428 0
414 9 428 0 797
333 0 781 2 458 9
414 01 286 9 784 7
280 9 428 0 281 0
428 0 487 0 458 0
486 797
239 5 789 00 269 9
239 5 789 00 269 9
281 0
250 82 707 15 401 9
486 286 9 250 0 0788 3 0787 2
486 286 9 250 0 0788 3 0787 2
707 0 788 20 340
707 0 788 20 340
788 20 496
788 20 496
812 20
719 45 781 2
707 14 788 21 414 9 355 8 344 1
707 14 788 21 414 9 355 8 344 1
805 4 724 2 781 2 719 4 1
788 30 781 2 427 3 1820 8
428 0 401 9 781 2
239 0 787 2 998 3 427 3 1511 9
894 1 788 29 599 0 716 9 9
894 1 788 29 599 0 716 9 9
Hope this might help you guys to help me out with the problem.
Thanks a lot.
Regards,
Hari.
-----Original Message-----
From: Sisyphus [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 25, 2002 10:23 AM
To: [EMAIL PROTECTED]
Subject: Re: Terrible at my logic
----- Original Message -----
From: "Krishna, Hari" <[EMAIL PROTECTED]>
>
> Heres my input:
>
> 486 286 9 250 00788 30787 2
>
This is different to the input you originally posted. (It is only 32
characters long.)
Just thought I'd pont that out in case it has a bearing on the solution to
this problem :-)
Cheers,
Rob
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs