Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove from an array to a temp file

Status
Not open for further replies.

cnw40007

Technical User
Mar 4, 2003
35
IE
Ok this is my problem. I have a file which contains email header info.I have written code below to parse through it for the To: line off a spreadsheet of usernames.Once i get a match what i would like to do is move that particular header to another file.At the moment it just rewrites the entire file to the temp file. The other problem i have is that the To: line is near the end of the header so how do i get it to remove from the start of that particular header to the end of it????

.....
.....
.....
foreach (@array)
{ my $list;
$list = $array[$counter];
$count ++;

$usrname;
if (/To:([^\@]+)/)
{
$usrname = $1;

}
for (my $counter=0;$counter<$#data+1;$counter++)
{
$temp = &quot;\L$data[$counter]&quot;;
#print &quot;$temp\n&quot;;
#print $usrname if($usrname =~ $temp);
if ($usrname eq &quot; $temp&quot;)
{
$array[$counter] = $usrname;
}
}
$usrname = &quot;&quot;;
}
...........

I hope i have explained this alright!!!Has anybody any ideas if you do great!!!
 
You can match the To: header like this I think:

/^To:.*?$/; Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top