Just in case this may be helpful as a future reference, here are two non-substr ways to get the results you want:
use Modern::Perl;
my $string = 'ATATTTATATTAT';
my ( $subStr1, $theRest1 ) = unpack '(a3)(a*)', $string;
say $subStr1;
say $theRest1, "\n";
my ( $subStr2, $theRest2 ) = $string =~ /(.{3})(.+)/;
say $subStr2;
say $theRest2;
Output:
ATA
TTTATATTAT
ATA
TTTATATTAT
unpack expands the original string into two chunks: the first being three characters and the second is the rest of the string. The second method uses two captures within a regex, matching three characters and then the remaining characters.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.