Re: Question about split

2009-10-23 Thread John W. Krahn
sanket vaidya wrote: Hi, Hello, Consider the code below: use warnings; use strict; my $string = '100955 BLow-Gomez,Joseph MMEX.AMER. QHUTC012'; my ($id) = split(/\s/,$string); print "id = $id"; Output: 100955 Now remove brackets surrounding $id like as under: use warnings; use strict;

Question about split

2009-10-23 Thread sanket vaidya
Hi, Consider the code below: use warnings; use strict; my $string = '100955 BLow-Gomez,Joseph MMEX.AMER. QHUTC012'; my ($id) = split(/\s/,$string); print "id = $id"; Output: 100955 Now remove brackets surrounding $id like as under: use warnings; use strict; my $s

Re: FW: Question about split

2009-06-08 Thread Gene
i.com] > Sent: Wednesday, May 27, 2009 4:16 PM > To: beginners@perl.org > Subject: Question about split > > Hi all, > > > > Kindly look at the code below: > > > > use warnings; > > use strict; > > > > $_ = 'Welcome to openSUSE 11.0 (X

FW: Question about split

2009-06-08 Thread Ajay Kumar
Because first element of the array is empty -Original Message- From: sanket vaidya [mailto:sanket.vai...@patni.com] Sent: Wednesday, May 27, 2009 4:16 PM To: beginners@perl.org Subject: Question about split Hi all, Kindly look at the code below: use warnings; use strict

RE: Question about split

2009-05-27 Thread sanket vaidya
-Original Message- From: Chas. Owens [mailto:chas.ow...@gmail.com] Sent: Wednesday, May 27, 2009 4:52 PM To: sanket vaidya Cc: beginners@perl.org Subject: Re: Question about split On Wed, May 27, 2009 at 06:45, sanket vaidya wrote: > Hi all, > > Kindly look at the code below

Re: Question about split

2009-05-27 Thread Chas. Owens
On Wed, May 27, 2009 at 06:45, sanket vaidya wrote: > Hi all, > > Kindly look at the code below: > > use warnings; > use strict; > > $_ = 'Welcome to openSUSE 11.0 (X86-64) - Kernel \r (\l).'; > > my @numbers = split /\D+/; snip > Why the first element of @numbers is 'blank'? Kindly explain with e

Question about split

2009-05-27 Thread sanket vaidya
Hi all, Kindly look at the code below: use warnings; use strict; $_ = 'Welcome to openSUSE 11.0 (X86-64) - Kernel \r (\l).'; my @numbers = split /\D+/; for (0..$#numbers) { print "$_ : $numbers[$_]\n"; } Output: 0 : 1 : 11 2 : 0 3 : 86 4 : 64 Why the first element