Hello I am working with a perl script and i have the following variable:
$string1="ZZ:DPHTEST1ZZ";
I would like to build two additional variables by getting a substring from $string1 using ":" as separator, I would like to add two prints in my script with the following outputs:
print $fragment1;
print $fragment2;
to get the following output:
ZZ
DPHTEST1ZZ
I tried with:
$fragment1 = substr $string1, index($string1, ':');
print $fragment1;
but I am getting:
:DPHTEST1ZZ
therefore I would like to appreciate to get this strings, by using the separator, i was researching a little and I just found methods of perl that use the position, thanks for the support,