Assigning to Substr

2011-09-06 Thread Emeka
Hello All, Could someone explain what Perl does behind here? Assign to Substring.. substr($string, 0 , 5) = 'Greetings'; Regards, Emeka -- *Satajanus Nig. Ltd *

Re: Assigning to Substr

2011-09-06 Thread Shawn H Corey
On 11-09-06 08:04 AM, Emeka wrote: Hello All, Could someone explain what Perl does behind here? Assign to Substring.. substr($string, 0 , 5) = 'Greetings'; Regards, Emeka It replaces the first 5 characters in $string with 'Greetings'. #!/usr/bin/env perl use strict; use warnings; my $str

Re: Assigning to Substr

2011-09-06 Thread Emeka
On Tue, Sep 6, 2011 at 1:19 PM, Shawn H Corey wrote: > On 11-09-06 08:04 AM, Emeka wrote: > >> Hello All, >> >> Could someone explain what Perl does behind here? >> >> Assign to Substring.. >> substr($string, 0 , 5) = 'Greetings'; >> >> >> Regards, >> Emeka >> > > It replaces the first 5 characte

Re: Assigning to Substr

2011-09-06 Thread Shawn H Corey
On 11-09-06 08:32 AM, Emeka wrote: I asked what Perl does behind.. Is it an alias or what? I want internal detailsor something technical. See `perldoc -f substr` and search for /lvalue/. -- Just my 0.0002 million dollars worth, Shawn Confusion is the first step of understanding. P

Re: Assigning to Substr

2011-09-07 Thread Rob Dixon
On 06/09/2011 13:04, Emeka wrote: Could someone explain what Perl does behind here? Assign to Substring.. substr($string, 0 , 5) = 'Greetings'; What do you want to know Emeka? There is no copy of the 'old' string, and substr behaves as documented. I have the C code of substr in front of me,

Re: Assigning to Substr

2011-09-07 Thread Emeka
Rob, I want to check out the C code. Kindly mail it to my box. Have a great day! Emeka On Wed, Sep 7, 2011 at 8:00 PM, Rob Dixon wrote: > On 06/09/2011 13:04, Emeka wrote: > >> >> Could someone explain what Perl does behind here? >> >> Assign to Substring.. >> substr($string, 0 , 5) = 'Greetin

Re: Assigning to Substr

2011-09-07 Thread Emeka
Rob, Which C file should check out? Emeka On Wed, Sep 7, 2011 at 8:08 PM, Emeka wrote: > Rob, > > I want to check out the C code. Kindly mail it to my box. > Have a great day! > > Emeka > > > On Wed, Sep 7, 2011 at 8:00 PM, Rob Dixon wrote: > >> On 06/09/2011 13:04, Emeka wrote: >> >>> >>> Co

Re: Assigning to Substr

2011-09-07 Thread Shlomi Fish
Hi Emeka, On Wed, 7 Sep 2011 20:49:44 +0100 Emeka wrote: > Rob, > > Which C file should check out? > > Emeka > Please look at the function definition starting from «PP(pp_substr)» in pp.c in the Perl 5 distribution: https://github.com/mirrors/perl/blob/blead/pp.c It seems pretty complicate

Re: Assigning to Substr

2011-09-08 Thread Rob Dixon
On 07/09/2011 20:49, Emeka wrote: On Wed, Sep 7, 2011 at 8:00 PM, Rob Dixon wrote: On Wed, Sep 7, 2011 at 8:08 PM, Emeka wrote: On 06/09/2011 13:04, Emeka wrote: Could someone explain what Perl does behind here? Assign to Substring.. substr($string, 0 , 5) = 'Greetings'; What do you wa