<?xml version="1.0" encoding="windows-1252"?>
<node id="1005080" title="Re: Is it possible to get all tetra words with correct starting position using a better code within a loop?" created="2012-11-22 03:51:51" updated="2012-11-22 03:51:51">
<type id="11">
note</type>
<author id="832495">
choroba</author>
<data>
<field name="doctext">
Use [doc://substr]:
&lt;c&gt;#!/usr/bin/perl
use warnings;
use strict;
use feature 'say';

my $string = 'ABCDEFGH';
my $length = 4;
for my $start (0 .. length($string) - $length) {
    say substr($string, $start, $length), " -&gt; Starting at position $start.";
}&lt;/c&gt;
Note that Perl uses 0 for the starting position, not 1. If you really need 1, just output &lt;c&gt;$start + 1&lt;/c&gt;.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-832495"&gt;

&amp;#1604;&amp;#1405;&amp;#4285;† &amp;#6514;&amp;#6482;&amp;#9898;&amp;#10186;&amp;#4281;&amp;#5651;&amp;#5511; &amp;#5045;&amp;#5651;&amp;#5511;&amp;#9137; &amp;#4281;&amp;#6514;&amp;#119243;&amp;#409;&amp;#5651;&amp;#5511;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1005077</field>
<field name="parent_node">
1005077</field>
</data>
</node>
