⭐ in reply to How do I pull n characters off the front of a string?
Bah! Why use regexes when there's a faster function designed for the purpose? =)
#assuming $n contains the number ... my $first_n = substr($string, 0, $n); #to grab $n off the end my $last_n = substr($string, -1, $n);
|
|---|