open(HNDL, "1.txt") or die "Cannot open text file";
while (<HNDL>)
{
if($.==2)
{
print $_;
$_ =~ s/\s//g;
print "after removing spaces $. :",$_;
}
}
output --
" 1 0 0 "
Actually, I need it as "100". So that I can perform some arithmetic operations.
Excuse if there is silly mistakes in using substitute. I'm just a beginner in perl..!!
while (<HNDL>)
{
if($.==2)
{
print $_;
$_ =~ s/\s//g;
print "after removing spaces $. :",$_;
}
}
output --
" 1 0 0 "
Actually, I need it as "100". So that I can perform some arithmetic operations.
Excuse if there is silly mistakes in using substitute. I'm just a beginner in perl..!!
Comment