Ruprecht Helms <rhe...@rheynmail.de> asked:
> how have I to write the printstatement to write a URL like
> http://www.example.com within the htmltag (<a
> href="http://www.example.com";>Linktext</a>) into a textfile.

Hm, for example

#!/usr/bin/perl -w

use strict;

my $file = '/some/path.txt';

my $text = '<a href="http://www.example.com";>Linktext</a>';

# naïve url extraction example. See mailing list archive for
# proper solution(s) of how to do this using a parser.
my( $url ) = ($text =~ m{a href="(.*?)"});

open( my $fh, '>', $file ) or die "Can't open '$file': $!";

print $fh "$url\n";

close( $fh )

__END__

OTTH & YMMV of course.

HTH,
Thomas

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to