in reply to Re: How to modify a file
in thread How to modify a file
Hi, I made this modification:
#!/usr/local/bin/perl open my $FILE, '<', 'rapipago.txt' or die "Cannot open file1.txt: $!"; my $outfile = "rapipagomod.txt"; open my $out, '>', $outfile or die "can't open $outfile: $!\n"; 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 $outfile $text; }
And I am receiving this error:
"Can't use string ("rapipagomod.txt")as a symbol ref while "strict refs" in use at C:\Users\ARIBIA~1\Desktop\Rapipago.pl line 15, <$FILE> line1."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to modify a file
by poj (Abbot) on Apr 25, 2013 at 18:06 UTC |