[ic] perl to strip hyphens etc?

DB DB at M-and-D.com
Tue Jun 22 11:59:45 EDT 2004


> DB wrote:
> 
>>> I think IC has some (perl?) magic to strip hyphens and spaces from
>>> credit card numbers. I want to do the same with phone numbers. Can
>>> anyone tell me where that is, or better yet post the magic perl snippet?
>>>
>>> DB
>> 
>> 
>> Ok I tried  the following but it seems to have no effect. I'm trying to
>> remove hyphens from a phone number before I write it to a file.
>> 
>> #clean up phone numbers
>> $phone_day=$array->{phone_day};
>> $phone_day=~ s/[\-]+/ /g;
>> print OUTFILE "$array->{phone_day}|";
>> 
>> Why does this not work? Any ideas?
>> 
>> DB
> 
> off the top of my head, if the code you've posted above is exactly what
> you're using, I'd say its because you've got a pipe "|" symbol at the
> end of the last line:
> 
> 	print OUTFILE "$array->{phone_day}|";
> 
> try it this way:
> 
> 	print OUTFILE "$array->{phone_day}";
> 
> That should work better.


I want the pipe.. I'm creating a pipe-delimited file :) But others have 
pointed out my dumb mistake... I was writing the unmodified version of 
the string. Doh! Thanks to all.

DB


More information about the interchange-users mailing list