removing a character at the begining of a variable
removing a character at the begining of a variable
(OP)
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
//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
RE: removing a character at the begining of a variable
$var =~ s/^.//;
adam@aauser.com