To get the substring after a specific character in Perl, you can use the `split` function and access the desired element of the resulting array.
In this example,
$url
with a value of "https://example.com/page"
.'/'
using the split
function and access the second element to get the substring after the specified character.$url = 'https://example.com/page';
@parts = split('/', $url);
$substring = $parts[1];
print 'Substring after '/': ' . $substring;
Substring after '/': example.com/page
In this example,
$str
with a value of "Hello,World"
.','
using the split
function and access the second element to get the substring after the specified character.$str = 'Hello,World';
@parts = split(',', $str);
$substring = $parts[1];
print 'Substring after ',': ' . $substring;
Substring after ',': World
In this tutorial, we learned How to get Substring after Specific Character in Perl language with well detailed examples.