Re: usage of Split

2010-07-28 Thread C.DeRykus
On Jul 28, 10:12 am, chandan_28...@yahoo.com (Chandan Kumar) wrote: > Hi , >   > using split ,I would like to split on space character. Dont want to use > character classes. > my $string="108 ambulance 100\nfireengine141jack"; >   > my @array = split /' '/,$string;  > From the doc: perldoc -f s

Re: usage of Split

2010-07-28 Thread Gunnar Hjalmarsson
On 07/28/10 19:12, Chandan Kumar wrote: using split ,I would like to split on space character. Dont want to use character classes. my $string="108 ambulance 100\nfireengine141jack"; my @array = split /' '/,$string; foreach my $value (@array){ print "$value \n"; } Result : its splitting on new

Re: usage of Split

2010-07-28 Thread Shlomi Fish
On Wednesday 28 Jul 2010 20:12:15 Chandan Kumar wrote: > Hi , > > using split ,I would like to split on space character. Dont want to use > character classes. my $string="108 ambulance 100\nfireengine141jack"; > > my @array = split /' '/,$string; > You need «my @array = split / /, $string;»

usage of Split

2010-07-28 Thread Chandan Kumar
Hi ,   using split ,I would like to split on space character. Dont want to use character classes. my $string="108 ambulance 100\nfireengine141jack";   my @array = split /' '/,$string;    foreach my $value (@array){ print "$value \n"; }   Result : its splitting on new line character.instead of spa

Re: usage of Split on pattern matching

2010-07-19 Thread Chandan Kumar
Thanks guys, I could able to understand split fun. --- On Mon, 19/7/10, John W. Krahn wrote: From: John W. Krahn Subject: Re: usage of Split on pattern matching To: "Perl Beginners" Date: Monday, 19 July, 2010, 4:29 PM Chandan Kumar wrote: > Hi all, Hello, > Iam beginner

Re: usage of Split on pattern matching

2010-07-19 Thread John W. Krahn
Chandan Kumar wrote: Hi all, Hello, Iam beginner to perl& i have a small query on split. using split i want print everything even the character used to split on string. Here is my example : my $string = "hi123now456itstimeforsplit789right" my @array = split ( '/(\d+\s)/ ',$string); ## Try

Re: usage of Split on pattern matching

2010-07-19 Thread Chas. Owens
On Mon, Jul 19, 2010 at 08:14, Chandan Kumar wrote: snip > my $string = "hi123now456itstimeforsplit789right" > my @array  = split ( '/(\d+\s)/ ',$string); snip > When I run the program ,it prints the whole string. so my assumption is wrong. > > please Could some one explain me on this? snip The s

usage of Split on pattern matching

2010-07-19 Thread Chandan Kumar
Hi all,   Iam beginner to perl & i have a small query on split. using split i want print everything even the character used to split on string.   Here is my example :   my $string = "hi123now456itstimeforsplit789right" my @array  = split ( '/(\d+\s)/ ',$string); ## Trying to split using digitnumbe