On Thu, 15 Aug 2002 01:40:16 -0700, [EMAIL PROTECTED] (Shivani) wrote: >how do i solve this? > >my $line="abcdefgh"; > >i want output which has 8 lines: >1st outline: abcdefgh >2nd outline:ab bc cd de ef fg gh >3nd outline:abc bcd cde def efg fgh >4th outline.......so on > >please let me know the shortest code tp perform this. i can run it but lot >of code..
Here is a brute-force approach adapted from a cookbook example. ######################################################## #!/usr/bin/perl my $line="abcdefgh"; print "$line\n"; @yeslap = $line =~ /(?=(\w\w))/g; print "@yeslap\n"; @yeslap = $line =~ /(?=(\w\w\w))/g; print "@yeslap\n"; @yeslap = $line =~ /(?=(\w\w\w\w))/g; print "@yeslap\n"; @yeslap = $line =~ /(?=(\w\w\w\w\w))/g; print "@yeslap\n"; @yeslap = $line =~ /(?=(\w\w\w\w\w\w))/g; print "@yeslap\n"; @yeslap = $line =~ /(?=(\w\w\w\w\w\w\w))/g; print "@yeslap\n"; @yeslap = $line =~ /(?=(\w\w\w\w\w\w\w\w))/g; print "@yeslap\n"; ######################################################## output: abcdefgh ab bc cd de ef fg gh abc bcd cde def efg fgh abcd bcde cdef defg efgh abcde bcdef cdefg defgh abcdef bcdefg cdefgh abcdefg bcdefgh abcdefgh -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]