in reply to Re: Lost Column
in thread Lost Column

thanks for your help. I see why this is a better code, but now when I do what Zaxo has suggezted, I get a failure saying:
substr outside of string at /mnt/ide0/home/wrml/ReturnA/ReturnAReplace +r.pl line 88, <IN> line 8453
This did not happen before. how can this be happening now? What does it mean that the substring is outside of the string?

Replies are listed 'Best First'.
Re^3: Lost Column
by AReed (Pilgrim) on Aug 18, 2005 at 22:36 UTC
    Sounds like the offset is beyond the end of the string being substringed. For example:
    my $woopsie = substr("Short line.",100);
    causes the same error message. Could you show us your revised code?
      Yeah, here it is.
      foreach $file (@infile){ open(IN, '<', "$file") or warn $! and next; open(OUT, '>', $outpath.basename($file)) or warn $! and next; while (<IN>) { substr($_,279) =~ s/$regex/$substitute{$1}/g; print OUT $_; } }
      These lines are huge. Much larger than 279 characters. by about 7000 characters. I can't figure this one out.
      Not a problem. here is the code:
      foreach $file (@infile){ open(IN, '<', "$file") or warn $! and next; open(OUT, '>', $outpath.basename($file)) or warn $! and next; while (<IN>) { substr($_,279) =~ s/$regex/$substitute{$1}/g; print OUT $_; } }
      These lines are very long. much longer than 279... I'm really confused.