[EMAIL PROTECTED] wrote:
Hi All,
Hello,
I need to copy a substring in a string which is completely out of the
primary string (in terms of the offset). substr does not allow me to do
so.
Do you mean like this:
$ perl -le' $_ = q/abc/; substr( $_, 20 ) = q/def/; print'
substr outside of string at -e line 1.
Is there any other way in which I can do that ?
What do you want to use to fill in the string between the two?
If you want to do what I think you want to do then you could use pack:
$ perl -le' $_ = q/abc/; $_ = pack q/A20 A*/, $_, q/def/; print'
abc def
Or sprintf:
$ perl -le' $_ = q/abc/; $_ = sprintf q/%-20s%s/, $_, q/def/; print'
abc def
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>