Is it possible to return just the captured portion of a regex using Perl's grep function? I have code such as the following:
use LWP::Simple;
my $examples_content = get('http://example.com/javascript/reports/examples/');
my @hrefs = grep(/href="(.*)"/, split("\n", $examples_content));
print $hrefs[0];
What gets printed though is:
When I'd like just: simple_chart.html
Why are you using grep? This might do what you want:
my @hrefs = $examples_content =~ /href="(.*?)"/g
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With