Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^3: Capture Lookahead

by GrandFather (Cardinal)
on Jul 26, 2005 at 02:25 UTC ( #478053=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Capture Lookahead
in thread Capture Lookahead

In that case you don't want a regex at all. Use substr.

use strict; use warnings; my $str = do {local $/; <DATA>}; $str =~ s/\s+//g; my $len = length $str; for (my $width = 5; $width; --$width) { for (0..($len - $width)) { print substr ($str, $_, $width) . "\n"; } } __DATA__ ABCDEFGHIJK
ABCDE BCDEF CDEFG DEFGH EFGHI FGHIJ GHIJK ABCD BCDE CDEF DEFG EFGH FGHI GHIJ HIJK ABC BCD CDE DEF EFG FGH GHI HIJ IJK AB BC CD DE EF FG GH HI IJ JK A B C D E F G H I J K

Perl is Huffman encoded by design.


Comment on Re^3: Capture Lookahead
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://478053]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2014-04-19 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (483 votes), past polls