R
Robert Wallace
is it possible to "do something" with the results of s/ ?
like:
$x =~ s/(abc)/search and replace again(xyz)/;
I have this:
$_=~s/(http\:\/\/|https\:\/\/|ftp\:\/\/)(\S+)/"\<a href\=\"$1$2\"\
target=\"_blank\">$2\<\/a\>"/eg; #change http:// to links
it takes something like
check out this cool link:
http://www.cpan.org/cgi-bin/test/one/two/three/four/five.pl its great!
and makes the link a hyperlink
I want to take it a step further.
I want it to display it this way:
check out this cool link: cpan.org its great!
I want it to chop off the trailing dirs and other symbols.
I'm having trouble conceptualizing code/direction for this.
can anyone give me a clue?
thanks
like:
$x =~ s/(abc)/search and replace again(xyz)/;
I have this:
$_=~s/(http\:\/\/|https\:\/\/|ftp\:\/\/)(\S+)/"\<a href\=\"$1$2\"\
target=\"_blank\">$2\<\/a\>"/eg; #change http:// to links
it takes something like
check out this cool link:
http://www.cpan.org/cgi-bin/test/one/two/three/four/five.pl its great!
and makes the link a hyperlink
I want to take it a step further.
I want it to display it this way:
check out this cool link: cpan.org its great!
I want it to chop off the trailing dirs and other symbols.
I'm having trouble conceptualizing code/direction for this.
can anyone give me a clue?
thanks