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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

removing a character at the begining of a variable 1

Status
Not open for further replies.

jerehart

Programmer
Jun 10, 1999
61
US
I know how to remove a character at the end of a line using chop but I want to remove a character at the beginning of the variable ie:

//tools/build/Operate/Operate1_2.bin

to

/tools/build/Operate/Operate1_2.bin

right now I am using a split to get at the directory path and then reforming it

$PathOnly = "";
$Target = /tools/build/Operate/Operate1_2.bin;

@Path = split(/\//,$Target);

for($i = 0; $i < $#Path; $i++)
{
next if $Path[$i] =~ /[\ \t\n]+/;
$PathOnly = join( '/',$Path[$i],$PathOnly);
}

Any ideas on how to remove the extra character or a better way to do this?

Miah
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top