Reputation: 793
I have this string:
my $string = "Stuff1, stuff2, stuff3, stuff4";
I want to save the substring "stuff3" in another string. For an example, to save stuff1 I use the following:
$substring = substr($string, 0, index($string, ','));
Basically, this takes all the characters until there is a ','
char and that way, I have stuff1 saved in a different string. How can I save string 3?
Thank you,
Upvotes: 0
Views: 62