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
Re: Terrible at my logic
- Original Message - From: FARRINGTON, RYAN [EMAIL PROTECTED] To: 'Sisyphus' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, October 26, 2002 1:21 AM Subject: RE: Terrible at my logic Sisyphus, you input string is incorrect. my $string = 486286 9 250 00788 30 787 2; #should be my $string = 486286 9 250 00788 30787 2; #according to the original email. Oh yeah ... and I can't count, either :-) So why the expectation that output will be different to input? (I missed that, too, first time round.) Shouldn't they be the same ? Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
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 486797 239 5 789 00 269 9 239 5 789 00 269 9 281 0 250 82 707 15 401 9 486286 9 250 00788 30 787 2 486286 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 486797 239 5 789 00 269 9 239 5 789 00 269 9 281 0 250 82 707 15 401 9 486286 9 250 0 0788 3 0787 2 486286 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:kalinabears;hdc.com.au] 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
Re: Terrible at my logic
BTW, for the sake of clarity when such a problem is presented, how about having a preamble saying that blank spaces will be shown here as some visible character not used in the problem? This would be useful for those of us with so-so eyesight, or who unfortunately have to put up with proportional fonts being forced upon them. Just a suggestion. Françoys On Friday 2002 October 25 11:32, Sisyphus wrote: - Original Message - From: FARRINGTON, RYAN [EMAIL PROTECTED] To: 'Sisyphus' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Saturday, October 26, 2002 1:21 AM Subject: RE: Terrible at my logic Sisyphus, you input string is incorrect. my $string = 486286 9 250 00788 30 787 2; #should be my $string = 486286 9 250 00788 30787 2; #according to the original email. Oh yeah ... and I can't count, either :-) So why the expectation that output will be different to input? (I missed that, too, first time round.) Shouldn't they be the same ? Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs -- Francoys Crepeau Ottawa, Ontario, Canada mailto:crepeaufr;rogers.com ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Terrible at my logic - some more inputs
- Original Message - From: Krishna, Hari [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, October 26, 2002 12:37 AM Subject: Terrible at my logic - some more inputs forgot to include the print statement print OUTPT $ln54_1 $ln54_2 $ln54_3 $ln54_4 $ln54_5 $ln54_6 $ln54_7 $ln54_8; Here's somemore inputs: 707 14788 21 414 9 355 8 344 1 805 4 724 2 781 2 719 41 788 30781 2 427 31820 8 Here's what my output looks like: 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 Here's what I am expecting my program to do: 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 Whats up with this?? Thanks a lot for your help. Regards, Hari. no warnings; my @string = (707 14788 21 414 9 355 8 344 1, 805 4 724 2 781 2 719 41, 788 30781 2 427 31820 8); for(@string) { for(my $i = 0; $i = 42; $i += 6) { print substr($_, $i, 6), ; } print \n; } prints: 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 I think this is what you also get. Why do you expect something else ? Cheers, Rob ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Terrible at my logic
Krishna, Hari wrote, on Friday, October 25, 2002 11:37 AM : Let me post how the input file looks like. : : 250 80707 13 294 8 : 332 0 286 5 428 0 : 486 286 9 250 00788 30787 2 : 707 14788 21 414 9 355 8 344 1 : : Here's how my output should look like: : : 250 80 707 13 294 8 : 332 0 286 5 428 0 : 486286 9 250 00788 30 787 2 : 707 14 788 21 414 9 355 8 344 1 It's pretty clear, then, that your third word isn't supposed to be just six characters. Look at the first line: the break between 250 80 and 707 13 makes it clear that the first word should be six characters; fine. All of your inputs have a space in the 13th position, so I can't tell for sure whether the second word should be six or seven characters (does the space belong with the second or third word?). But look at the third line of input (abbreviated from your longer input) and compare it to the output. There are *no* extra spaces in the expected output until the gap between 30 and 787. So obviously you expect (assuming the second word is six characters, and the space in the 13th position belongs to the third word) the input 250 00788 30 to all be one word, so the third word should be thirteen characters! The final word absorbs any remaining characters; no input shown has more than five more, and your output expects it to be a single, fourth, word. Joe == Joseph P. Discenza, Sr. Programmer/Analyst mailto:jdiscenza;carletoninc.com Carleton Inc. http://www.carletoninc.com 574.243.6040 ext. 300fax: 574.243.6060 Providing Financial Solutions and Compliance for over 30 Years * Please note that our Area Code has changed to 574! * ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Terrible at my logic
Title: RE: Terrible at my logic 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
Re: Terrible at my logic - some more inputs
On 25/10/2002 15:37:16 Krisna, Hari wrote: forgot to include the print statement print OUTPT $ln54_1 $ln54_2 $ln54_3 $ln54_4 $ln54_5 $ln54_6 $ln54_7 $ln54_8; change this to: print OUTPT $ln54_1!$ln54_2!$ln54_3!$ln54_4!$ln54_5!$ln54_6!$ln54_7!$ln54_8!; You separate the columns with spaces and your input also contains spaces, this makes it difficult to distinguish between the two (is that space from the input or is it a separator ?). Use the exclamation marks as eye-catchers; you'll be able to see what's going on. -- Csaba Ráduly, Software Engineer Sophos Anti-Virus email: [EMAIL PROTECTED]http://www.sophos.com US Support: +1 888 SOPHOS 9 UK Support: +44 1235 559933 ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs