in reply to extract URLs from text

How about this using URI::Find ...

#!/usr/bin/perl -Tw use URI::Find; use strict; my $text = " ... long string with lots of URLs ... "; my @urls; find_uris($text, sub { my ($uri, $orig_uri) = @_; push @urls, $orig_uri; }); print join("\n", @urls), "\n"; exit 0;

Note that the CPAN documentation for URI::Find is out-of-date with the newest version (0.04) exporting only the one function, find_uris, which takes two arguments, the string to be searched and a function reference.

 

perl -e 's&&rob@cowsnet.com.au&&&split/[@.]/&&s&.com.&_&&&print'