http://www.perlmonks.org?node_id=1029120


in reply to Re^3: Adding a TAB after a certain ammount of characters
in thread Adding a TAB after a certain ammount of characters

Please show us your perl1.pl script inside <code> and </code> tags so we can see where you are going wrong. As for working on a multi-line file, calculate the offsets, open your file then do something like

while ( <$inputFH> ) { foreach my $offset ( reverse @cums[ 1 .. $#cums ] ) } substr $_, $offset, 0, q{-}; } print; }

I hope this moves you forward.

Update: Code modified to replace for statement modifier with an explicit loop, thanks choroba.

Cheers,

JohnGG