Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Perl Code Question


FixItPete

Recommended Posts

Anyone here good with Perl?

 

Here's the question:

 

I have a field that is read from a flat file and assigned a $name in some code.

 

So, let's say the flat file looks like this:

 

Monkey_Brains|1.00|Brown

 

Naturally, the first field is "Monkey_Brains"

The second field is "1.00"

The third field is "Brown"

 

The first field is assigned a variable, we'll call it:

 

$name

 

Now here's what I would like to do. All the fields in the $name spot have an underscore '_' between each word. I would like code that could read this field and strip the underscore out. So "Monkey_Brains" would be come "Monkey Brains"

 

In essence:

 

$name would equal "Monkey_Brains"

 

Then some code that reads and modifies $name

 

$modifiedname would now equal "Monkey Brains"

 

Many Thanks,

 

Pete

I find the fun in everything.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...