Nearly there now

They have: 88 posts

Joined: Mar 1999

Hi all,

Just about finished my script at last Smiling

Just need to know how to remove any commas
from a variable prior to writing it to a
text file.

example:

$address=param('address'); (* need to remove commas here *)

open(file,">>$failit");

print file "$address ,";

Any ideas - it's probably easy but my head is hurting
Sad

Thanks in advance for any help

Regards

Steve

On the last lap - seeing the finishing line Smiling

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

$address =~ s/,//g;

That will take every occurance of a comma and replace it with nothing.

VulKen
I'm Thinker Then I Drunk I Am

They have: 88 posts

Joined: Mar 1999

many thanks for that -

But where would it go in my example?

sorry to be a pain Smiling

Cheers

Steve

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

just put it right after your scalars assignment...

$address=param('address'); (* need to remove commas here *)

And Before your open statement

open(file,">>$failit");

So that it is processed before you open the file and write the contents.

VulKen
I Hurl For PERL

Pimpin like a pimp with an electrofied pimpin machine!

They have: 88 posts

Joined: Mar 1999

Many thanks - I'll give that a go!!

Thanks a lot for the help Smiling

Regards

Steve

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.