Re: doubt in substring

2011-01-15 Thread Kenneth Wolcott
On Sat, Jan 15, 2011 at 03:20, Dr.Ruud wrote: > On 2011-01-15 08:52, Emeka wrote: > >> rmicro@RMICRO-PC C:\Program Files\xampp >> # perl -le '$str =  "the cat sat on the mat";print substr( $str, 4, -4 )' >> Can't find string terminator "'" anywhere before EOF at -e line 1. > > On Windows it should

Re: doubt in substring

2011-01-15 Thread Dr.Ruud
On 2011-01-15 08:52, Emeka wrote: rmicro@RMICRO-PC C:\Program Files\xampp # perl -le '$str = "the cat sat on the mat";print substr( $str, 4, -4 )' Can't find string terminator "'" anywhere before EOF at -e line 1. On Windows it should probably look like: # perl -wle "$s=q{abc def ghi jkl};pr

Re: doubt in substring

2011-01-15 Thread Emeka
*If I were beginning with Perl, I certainly would not practise in the console but get an editor, such as SciTE* Yes, I am. On Sat, Jan 15, 2011 at 3:04 PM, John Delacour wrote: > On 15 January 2011 07:52, Emeka wrote: > > > # perl -le '$str = "the cat sat on the mat";print substr( $str, 4, -4

Re: doubt in substring

2011-01-15 Thread John Delacour
On 15 January 2011 07:52, Emeka wrote: > # perl -le '$str = "the cat sat on the mat";print substr( $str, 4, -4 )' > Can't find string terminator "'" anywhere before EOF at -e line 1. > > rmicro@RMICRO-PC C:\Program Files\xampp > # > > It failed to work for me. Why? Because you can't use single

Re: doubt in substring

2011-01-14 Thread Emeka
Setting environment for using XAMPP for Windows. rmicro@RMICRO-PC C:\Program Files\xampp # perl -le '$str = "the cat sat on the mat";print substr( $str, 4, -4 )' Can't find string terminator "'" anywhere before EOF at -e line 1. rmicro@RMICRO-PC C:\Program Files\xampp # It failed to work for me

Re: doubt in substring

2011-01-13 Thread Shawn H Corey
On 11-01-12 11:27 PM, Sunita Rani Pradhan wrote: I have a string as; $str = "the cat sat on the mat" . How the following command works substr($str , 4, -4) on the string ? What should be the output? TITS (Try It To See) perl -le '$str = "the cat sat on the mat";print substr(

Re: doubt in substring

2011-01-12 Thread C.DeRykus
On Jan 12, 8:27 pm, sunita.prad...@altair.com ("Sunita Rani Pradhan") wrote: > Hi All > >             I have a string as; $str =  "the cat sat on the mat" . > > How the following command works substr($str , 4, -4)  on the string ? > What should be the output? > See: perldoc -f substr Check the do

Re: doubt in substring

2011-01-12 Thread ashwin ts
the output will be cat sat on the all the characters in the string $str except four characters from the left and right will be displayed... Regards Ashwin Thayyullathil Surendran On Thu, Jan 13, 2011 at 9:57 AM, Sunita Rani Pradhan < sunita.prad...@altair.com> wrote: > Hi All > > > >

doubt in substring

2011-01-12 Thread Sunita Rani Pradhan
Hi All I have a string as; $str = "the cat sat on the mat" . How the following command works substr($str , 4, -4) on the string ? What should be the output? Thanks Sunita