Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^9: Adding a TAB after a certain ammount of characters

by biancoari (Initiate)
on Apr 17, 2013 at 17:33 UTC ( [id://1029183]=note: print w/replies, xml ) Need Help??


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

Thanks everyone, I was able to complete it, here is the the final product

#!/usr/local/bin/perl open my $FILE, '<', 'rapipago.txt' or die "Cannot open file1.txt: $!"; use strict; use warnings; use feature 'say'; while (my $text = <$FILE>) { chomp $text; my @cums = (0); my @offs = ( 17, 6, 31, 3, 3 ); my @cums = ( 0 ); push @cums, $_ + $cums[ -1 ] for @offs; substr $text, $_, 0, q{-} for reverse @cums[ 1 .. $#cums ]; say $text; }

Now I have another question, is there a way that instead of printing with say, the results prints on another file, or the program modifies my first file with the result?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1029183]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-04-19 14:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found