View Single Post
  #1  
Old 11-08-2005, 06:11 PM
GottaDiesel's Avatar
GottaDiesel GottaDiesel is offline
Banned
 
Join Date: Sep 2003
Location: New Jersey
Posts: 1,561
Perl Programming Question.

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
Reply With Quote