Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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?
[simplex]: Someone here who has knwoledge of wxperl ?

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2017-01-22 21:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (190 votes). Check out past polls.