Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Capture Lookahead

by GrandFather (Sage)
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.

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 chilling in the Monastery: (11)
As of 2016-07-27 13:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?


















    Results (242 votes). Check out past polls.