> : $string =~ s/(\S{40}/\1 /g;
>
> You should really consider turning warnings on.
>
> #!/usr/bin/perl -w
I always use warnings, though I am developping on one system, and reading my
news on another (NNTP-enabled) one. therefore I can't copy and paste. it was
a typo indeed but only in my posting. not in the code :-) Thanks anyway
>
> There's a typo. The parenthesis doesn't close. When
> you post code, try to cut and paste it from the source.
>
>
> : now I wonder if it is possible to print the resulting
> : spaced string without changing $string itself? do I
> : really need a temporary variable or is it possible to
> : do something like:
> :
> : print $string s/(\S{4})/\1 /g;
>
> Use a subroutine that returns the value without
> affecting the original. Then print the returned value.
>
> print break( $string, 4 );
>
> sub break {
> my $copy = shift;
> $copy =~ s/(\S{$_[0]})/$1 /g;
> return $copy;
> }
well I had hoped to save a temporary variable as well as create some more
compact code ...
nice hint anyway.
Thanks,
JP
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>