B
Bill H
I do a lot of small routines in perl for manipulating data and know
there has to be an easier way of trimming the spaces off the begining
and ending of a variable. I use the following which is basically a
translation of a BASIC routine I have used for years:
while(substr($temp,0,1) eq " ")
{
$temp = substr($temp,1);
}
while(substr($temp,-1) eq " ")
{
$temp = substr($temp,0,length($temp) - 1);
}
There has to be a simpler way in perl than this.
Bill H
there has to be an easier way of trimming the spaces off the begining
and ending of a variable. I use the following which is basically a
translation of a BASIC routine I have used for years:
while(substr($temp,0,1) eq " ")
{
$temp = substr($temp,1);
}
while(substr($temp,-1) eq " ")
{
$temp = substr($temp,0,length($temp) - 1);
}
There has to be a simpler way in perl than this.
Bill H