Hello Monks,
I am trying to find out length of each line of file. I am using length function. Problem is length function is counting tab as a single char and not as 4 chars
input file :
This line has no tab.
This line has tab at the beginning.
Script I am using :
open(my $fh, '<', $inputfile);
my %line_chars;
my $line_number = 1;
while (my $row = <$fh>) {
if ($line_number > 1) {
$line_chars{$line_number} = $line_chars{$line_number -
+1} + length($row);
}
else {
$line_chars{$line_number} = length($row);
}
$line_number++;
}
Here I need output with all spaces before and after line. specially when line starts with tab