|The stupid question is the question not asked|
Answer: How do I pull n characters off the front of a string?
Q&A > strings > How do I pull n characters off the front of a string? contributed by davido
The other examples all handed off the first $n characters. But they didn't remove those first $n characters from the original $string, as the question required.
As always, there is more than one way to do it. For each of the examples below, assume the following setup:
Another with substr:
And probaby the best substr solution:
With a substitution s/// regexp:
With a pattern match (m//):
With unpack (Not for the faint of heart):