I have a datafile in the format of the file which is attached, from which I
want to extract email addresses. (I have had to reduce the file's contents
in order to send it to the list. As a result of this, there might not be
all that many addresses in the data). I can see that they are in the file
if I open it in Notepad. However, I can't seem to extract it, as I would
expect to be able to using the code below:
$DATA = &LOAD("$FILENAME");
@RES = ($DATA =~ m/\<(.*?)\>/igs);
print "Addresses are: @RES";
#Load a File into a Variable.
sub LOAD {
my($FILE) = @_;
my $CHKOPN = open(DATAFILE, "$FILE");
my $HTML;
if ($CHKOPN == 1) {
local $/;
$HTML = <DATAFILE>;
close(DATAFILE);
}
else {
$MESSAGE = "Unable to open file $FILE";
&ERROR;
}
return $HTML;
}
I would expect the list of email addresses to have been pulled into
@RES. The file contains a lot of 'rubbish'', which I think might be
interfering with the way that Perl works.
Any ideas on how to get around this problem would be greatly appreciated.
TIA
Roland
--
Roland Corbet
Systems Administrator & Developer
Psyche Solutions Limited
Chester Road
Cradley Heath
West Midlands
B64 6AB
Tel: + 44 (0)1384 414183 Ext. 4412
Fax: + 44 (0)1384 414111
E-Mail: [EMAIL PROTECTED]
WWW: http://www.psyche.net.uk
Datafile