Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
However, i want to do this in a loop where $1 is already being used as something else, hence this doesn't work! Can anyone suggest an alternative?? Thanks!$string =~ s/(.{60})/$1\n/g;
if ($line =~ /^\s{0,3}(\w+)(\d+)(\w+)\s+((\w+))/) { # $1-$3 used by something else here my $string = $4; $string =~ s/(.{60})/$1\n/g; print "$string\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: formatting strings
by borisz (Canon) on Jan 05, 2005 at 11:10 UTC | |
|
Re: formatting strings
by ysth (Canon) on Jan 05, 2005 at 11:01 UTC | |
|
Re: formatting strings
by pelagic (Priest) on Jan 05, 2005 at 11:05 UTC | |
by legato (Monk) on Jan 05, 2005 at 14:50 UTC | |
|
Re: formatting strings
by thor (Priest) on Jan 05, 2005 at 11:54 UTC | |
|
Re: formatting strings
by ikegami (Patriarch) on Jan 05, 2005 at 17:31 UTC |